carbon-components-svelte/docs/src/pages/components/TreeView.svx
Eric Liu 9114298f76
Align 10.40 (#763)
* docs: fix typo [ci skip]

* docs(tree-view): update expanded nodes guidance

* chore(deps-dev): upgrade carbon-components to v10.40.0

* build(css): omit treeview SCSS import

treeview.scss is included in global styles.css by default in v10.40.0

* feat(date-picker): add helperText prop

Ref: 4b5b5fdf8
2021-07-22 16:56:51 -07:00

48 lines
No EOL
1.3 KiB
Text

<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
Expanded nodes can be set using `expandedIds`.
<FileSource src="/framed/TreeView/TreeViewExpanded" />
### Initial multiple selected nodes
Initial multiple selected nodes can be set using `selectedIds`.
<FileSource src="/framed/TreeView/TreeViewMultiselect" />