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
<RecursiveList
items={[
{
text: "Item 1",
items: [
{
text: "Link",
href: "/",
items: [
{
html: "<h5>Hello world</h5>",
},
],
},
],
},
{
text: "Item 1",
}
]}
/>
<FileSource src="/framed/RecursiveList/RecursiveList" />
### Ordered
<RecursiveList
type="ordered"
items={[
{
text: "Item 1",
items: [
{
text: "Link",
href: "/",
items: [
{
html: "<h5>Hello world</h5>",
},
],
},
],
},
{
text: "Item 1",
}
]}
/>
<FileSource src="/framed/RecursiveList/RecursiveListOrdered" />
### Ordered (native styles)
<RecursiveList
type="ordered-native"
items={[
{
text: "Item 1",
items: [
{
text: "Link",
href: "/",
items: [
{
html: "<h5>Hello world</h5>",
},
],
},
],
},
{
text: "Item 1",
}
]}
/>
<FileSource src="/framed/RecursiveList/RecursiveListOrderedNative" />

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}" />