TreeItem
An item within a <Tree>
Code
<script lang="ts">
import { TreeItem } from '@geoffcox/sterling-svelte';
</script>
<TreeItem text="sterling-svelte" value="item">
<TreeItem value="child1" text="Child 1"/>
<!-- TODO: Add more TreeItem children here -->
</TreeItem>
Members
| Property Name | Type | Default | Comment | | disabled | boolean | false |
| text | string | undefined | undefined |
| value | string | undefined |
| variant | string | '' |
| Method Name | Parameters | Return Type | Comment | | collapse | | |
| expand | | |
| select | | |
| selectParent | | |
| selectPrevious | | |
| selectNext | | |
| toggleExpanded | | |
Considerations
- By default, renders a TreeItemDisplay
- A tree item is identified by having data-value and role="treeitem" properties
- Includes HTMLDivElement props, event, and methods
Anatomy
<div class="sterling-tree-item">
<div class="item">
<slot name="item" {depth} {disabled} {expanded} {hasChildren} {selected} {value} {variant}>
<TreeItemDisplay>
<slot name="label" {depth} {disabled} {expanded} {hasChildren} {selected} {value} {variant}
>{text || value}
</slot>
</TreeItemDisplay>
</slot>
</div>
<div class="children">
<slot {depth} {disabled} {selected} {value} {variant} />
</div>
</div>