docs(recursive-list): add full examples

This commit is contained in:
Eric Y Liu 2021-07-03 04:06:23 -07:00
commit 0cc3ede6e4
4 changed files with 105 additions and 65 deletions

View file

@ -5,74 +5,12 @@
### Unordered ### Unordered
<RecursiveList <FileSource src="/framed/RecursiveList/RecursiveList" />
items={[
{
text: "Item 1",
items: [
{
text: "Link",
href: "/",
items: [
{
html: "<h5>Hello world</h5>",
},
],
},
],
},
{
text: "Item 1",
}
]}
/>
### Ordered ### Ordered
<RecursiveList <FileSource src="/framed/RecursiveList/RecursiveListOrdered" />
type="ordered"
items={[
{
text: "Item 1",
items: [
{
text: "Link",
href: "/",
items: [
{
html: "<h5>Hello world</h5>",
},
],
},
],
},
{
text: "Item 1",
}
]}
/>
### Ordered (native styles) ### Ordered (native styles)
<RecursiveList <FileSource src="/framed/RecursiveList/RecursiveListOrderedNative" />
type="ordered-native"
items={[
{
text: "Item 1",
items: [
{
text: "Link",
href: "/",
items: [
{
html: "<h5>Hello world</h5>",
},
],
},
],
},
{
text: "Item 1",
}
]}
/>

View file

@ -0,0 +1,34 @@
<script>
import { RecursiveList } from "carbon-components-svelte";
const children = [
{
text: "Item 1",
children: [
{
text: "Link",
href: "/",
children: [
{
html: "<h5>Hello world</h5>",
children: [{ text: "Item 1a" }],
},
],
},
],
},
{
text: "Item 2",
children: [
{
text: "Item 2 content",
},
],
},
{
text: "Item 3",
},
];
</script>
<RecursiveList children="{children}" />

View file

@ -0,0 +1,34 @@
<script>
import { RecursiveList } from "carbon-components-svelte";
const children = [
{
text: "Item 1",
children: [
{
text: "Link",
href: "/",
children: [
{
html: "<h5>Hello world</h5>",
children: [{ text: "Item 1a" }],
},
],
},
],
},
{
text: "Item 2",
children: [
{
text: "Item 2 content",
},
],
},
{
text: "Item 3",
},
];
</script>
<RecursiveList type="ordered" children="{children}" />

View file

@ -0,0 +1,34 @@
<script>
import { RecursiveList } from "carbon-components-svelte";
const items = [
{
text: "Item 1",
items: [
{
text: "Link",
href: "/",
items: [
{
html: "<h5>Hello world</h5>",
items: [{ text: "Item 1a" }],
},
],
},
],
},
{
text: "Item 2",
items: [
{
text: "Item 2 content",
},
],
},
{
text: "Item 3",
},
];
</script>
<RecursiveList type="ordered-native" items="{items}" />