feat: add toHierarchy utility for TreeView, RecursiveList (#2072)

Co-authored-by: Bram <bramhavers@gmail.com>
This commit is contained in:
Eric Liu 2024-12-09 12:22:36 -08:00 committed by GitHub
commit 48afd18e5e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 413 additions and 23 deletions

View file

@ -0,0 +1,28 @@
<script lang="ts">
import { RecursiveList } from "carbon-components-svelte";
const nodes = [
{
text: "Item 1",
nodes: [
{
text: "Item 1a",
nodes: [{ html: "<h5>HTML content</h5>" }],
},
],
},
{
text: "Item 2",
nodes: [
{ href: "https://svelte.dev/" },
{
href: "https://svelte.dev/",
text: "Link with custom text",
},
],
},
{ text: "Item 3" },
];
</script>
<RecursiveList type="ordered" {nodes} />