Tree
A hierarchy of <TreeItem>s that can be expanded/collapsed where a single item can be selected
Code
<script lang="ts">
import { Tree } from '@geoffcox/sterling-svelte';
let expandedValues: string[] = [];
let selectedValue: string | undefined = undefined;
</script>
<Tree bind:expandedValues bind:selectedValue>
<!-- <TreeItem> ... -->
</List>
Members
| Property Name | Type | Default | Comment | | disabled | boolean | false |
| selectedValue | string | undefined | undefined |
| expandedValues | string[] | [] |
| variant | string | '' |
| Event Name | Data | Comment | | expandCollapse | { expandedValues: string[] } |
| select | { selectedValue: string } |
Considerations
- Includes HTMLDivElement props, event, and methods
Anatomy
<div class="sterling-tree">
<!-- children -->
<slot {disabled} {expandedValues} {selectedValue} {variant} />
</div>