mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 18:31:06 +00:00
TreeView (#725)
* feat(tree-view): add TreeView * fix(tree-view): select initial active node, correct typedefs * docs(tree-view): update examples * chore(tree-view): add test for types * docs(tree-view): rename example * docs(tree-view): improve docs * docs(tree-view): refine examples * docs: fix invalid syntax * chore: rebuild component index/api * docs(layout): increase height of sidenav menu [ci skip]
This commit is contained in:
parent
f4a3646cb4
commit
6ed4aaa86e
25 changed files with 1176 additions and 4 deletions
48
docs/src/pages/components/TreeView.svx
Normal file
48
docs/src/pages/components/TreeView.svx
Normal file
|
@ -0,0 +1,48 @@
|
|||
<script>
|
||||
import { InlineNotification } from "carbon-components-svelte";
|
||||
import Preview from "../../components/Preview.svelte";
|
||||
</script>
|
||||
|
||||
### Default
|
||||
|
||||
The `children` prop accepts an array of child nodes. Each node should contain `id` and `text` properties.
|
||||
|
||||
Optional properties include `disabled`, `expanded`, `icon`, and `children`.
|
||||
|
||||
A parent node contains `children` while a leaf node does not.
|
||||
|
||||
<InlineNotification svx-ignore title="Note:" kind="info" hideCloseButton>
|
||||
<div class="body-short-01">Every node must have a unique id.</div>
|
||||
</InlineNotification>
|
||||
|
||||
<FileSource src="/framed/TreeView/TreeView" />
|
||||
|
||||
### Initial active node
|
||||
|
||||
The active node can be set through `activeId`.
|
||||
|
||||
<FileSource src="/framed/TreeView/TreeViewActive" />
|
||||
|
||||
### Compact size
|
||||
|
||||
Set `size` to `"compact"` to use the compact variant.
|
||||
|
||||
<FileSource src="/framed/TreeView/TreeViewCompact" />
|
||||
|
||||
### With icons
|
||||
|
||||
To render a node with an icon, define an `icon` property with a Carbon Svelte icon as its value.
|
||||
|
||||
<FileSource src="/framed/TreeView/TreeViewIcons" />
|
||||
|
||||
### Initial expanded nodes
|
||||
|
||||
Set `expanded` to `true` on nodes that should be expanded by default.
|
||||
|
||||
<FileSource src="/framed/TreeView/TreeViewExpanded" />
|
||||
|
||||
### Initial multiple selected nodes
|
||||
|
||||
Initial multiple selected nodes can be set using `selectedIds`.
|
||||
|
||||
<FileSource src="/framed/TreeView/TreeViewMultiselect" />
|
Loading…
Add table
Add a link
Reference in a new issue