Tree
A hierarchy of links with keyboard navigation.
beta
Try it
<Tree label="Project files" />Examples
Project files
Configuration: three production replicas.
Stable release: gateway v2.4.
<script lang="ts">
import Tree from '@tcpsystems/ui/foundation/Tree';
import Stack from '@tcpsystems/ui/foundation/Stack';
const uid = $props.id();
</script>
<Stack>
<Tree label="Gateway files" items={[
{ id: `${uid}-gateway`, label: 'Gateway', children: [
{ id: `${uid}-config`, label: 'Configuration', href: `#${uid}-config`, current: true },
{ id: `${uid}-releases`, label: 'Releases', expanded: false, children: [
{ id: `${uid}-stable`, label: 'Stable release', href: `#${uid}-stable` }
] }
] }
]} />
<p id={`${uid}-config`}>Configuration: three production replicas.</p>
<p id={`${uid}-stable`}>Stable release: gateway v2.4.</p>
</Stack>Unavailable
Archived services are read only.
<script lang="ts">
import Tree from '@tcpsystems/ui/foundation/Tree';
import Stack from '@tcpsystems/ui/foundation/Stack';
const uid = $props.id();
</script>
<Stack>
<Tree label="Archived services" aria-disabled="true" items={[{ id: `${uid}-archive`, label: 'Legacy proxy', href: `#${uid}-archive` }]} />
<p id={`${uid}-archive`}>Archived services are read only.</p>
</Stack>Empty
No files yet. Connect a repository to browse its files.
<script lang="ts">
import Tree from '@tcpsystems/ui/foundation/Tree';
import Stack from '@tcpsystems/ui/foundation/Stack';
</script>
<Stack>
<Tree label="Project files" items={[]} />
<p>No files yet. Connect a repository to browse its files.</p>
</Stack>API
import Tree from '@tcpsystems/ui/foundation/Tree';| Prop | Type | Default |
|---|---|---|
mode? | 'links' | 'view' | 'links' |
items? | Item[] | [] |
label? | string | 'Tree' |
selected? | string[] | $bindable([]) |
| Hook | Kind |
|---|---|
.tcp-tree | Root class |
data-expanded | Data attribute |
data-id | Data attribute |