mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
RecursiveList (#717)
* feat(recursive-list): add RecursiveList * feat(recursive-list): rename items prop to children * docs(recursive-list): add full examples * test(recursive-list): add types test * refactor(recursive-list): remove superfluous nested prop * docs(recursive-list): update docs * fix(recursive-list): remove nested prop from type test * fix(recursive-list): explicitly type restProps
This commit is contained in:
parent
870c2c2ae8
commit
ae27bedf4c
17 changed files with 334 additions and 6 deletions
32
docs/src/pages/framed/RecursiveList/RecursiveList.svelte
Normal file
32
docs/src/pages/framed/RecursiveList/RecursiveList.svelte
Normal file
|
@ -0,0 +1,32 @@
|
|||
<script>
|
||||
import { RecursiveList } from "carbon-components-svelte";
|
||||
|
||||
const children = [
|
||||
{
|
||||
text: "Item 1",
|
||||
children: [
|
||||
{
|
||||
text: "Item 1a",
|
||||
children: [{ html: "<h5>HTML content</h5>" }],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "Item 2",
|
||||
children: [
|
||||
{
|
||||
href: "https://svelte.dev/",
|
||||
},
|
||||
{
|
||||
href: "https://svelte.dev/",
|
||||
text: "Link with custom text",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "Item 3",
|
||||
},
|
||||
];
|
||||
</script>
|
||||
|
||||
<RecursiveList children="{children}" />
|
|
@ -0,0 +1,32 @@
|
|||
<script>
|
||||
import { RecursiveList } from "carbon-components-svelte";
|
||||
|
||||
const children = [
|
||||
{
|
||||
text: "Item 1",
|
||||
children: [
|
||||
{
|
||||
text: "Item 1a",
|
||||
children: [{ html: "<h5>HTML content</h5>" }],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "Item 2",
|
||||
children: [
|
||||
{
|
||||
href: "https://svelte.dev/",
|
||||
},
|
||||
{
|
||||
href: "https://svelte.dev/",
|
||||
text: "Link with custom text",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "Item 3",
|
||||
},
|
||||
];
|
||||
</script>
|
||||
|
||||
<RecursiveList type="ordered" children="{children}" />
|
|
@ -0,0 +1,32 @@
|
|||
<script>
|
||||
import { RecursiveList } from "carbon-components-svelte";
|
||||
|
||||
const children = [
|
||||
{
|
||||
text: "Item 1",
|
||||
children: [
|
||||
{
|
||||
text: "Item 1a",
|
||||
children: [{ html: "<h5>HTML content</h5>" }],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "Item 2",
|
||||
children: [
|
||||
{
|
||||
href: "https://svelte.dev/",
|
||||
},
|
||||
{
|
||||
href: "https://svelte.dev/",
|
||||
text: "Link with custom text",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "Item 3",
|
||||
},
|
||||
];
|
||||
</script>
|
||||
|
||||
<RecursiveList type="ordered-native" children="{children}" />
|
Loading…
Add table
Add a link
Reference in a new issue