Skip to content
tcpsystemsui

Theme

Colour scheme
Accent
Density
Radius
Esc

Tree

A hierarchy of links with keyboard navigation.

beta

Try it

Svelte
<Tree label="Project files" />

Examples

Project files

Configuration: three production replicas.

Stable release: gateway v2.4.

Project files.svelte
<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.

Unavailable.svelte
<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.

Empty.svelte
<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
import Tree from '@tcpsystems/ui/foundation/Tree';
PropTypeDefault
mode?'links' | 'view''links'
items?Item[][]
label?string'Tree'
selected?string[]$bindable([])
HookKind
.tcp-treeRoot class
data-expandedData attribute
data-idData attribute