mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 11:36:36 +00:00
docs(recursive-list): add full examples
This commit is contained in:
parent
38d14562bb
commit
0cc3ede6e4
4 changed files with 105 additions and 65 deletions
|
@ -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" />
|
34
docs/src/pages/framed/RecursiveList/RecursiveList.svelte
Normal file
34
docs/src/pages/framed/RecursiveList/RecursiveList.svelte
Normal 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}" />
|
|
@ -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}" />
|
|
@ -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}" />
|
Loading…
Add table
Add a link
Reference in a new issue