Skip to content

@jsvision/ui / TreeOptions

Interface: TreeOptions<T> ​

Defined in: ui/src/tree/tree.ts:23

Construction options for Tree.

Type Parameters ​

T ​

T

Properties ​

command? ​

optional command?: string

Defined in: ui/src/tree/tree.ts:35

Command name emitted on activation, handled elsewhere; no built-in default.


expandedByDefault? ​

optional expandedByDefault?: boolean

Defined in: ui/src/tree/tree.ts:37

Seed every node that has children as expanded at construction (default false = all collapsed).


focused? ​

optional focused?: Signal<number>

Defined in: ui/src/tree/tree.ts:29

The focused (highlighted) flattened-visible index (default an internal signal at 0).


getText ​

getText: (value) => string

Defined in: ui/src/tree/tree.ts:27

Render a node's value to its row text.

Parameters ​

value ​

T

Returns ​

string


guides? ​

optional guides?: boolean

Defined in: ui/src/tree/tree.ts:39

Draw the │├└─ connectors (default true); false = flat indent, markers unchanged.


markerStyle? ​

optional markerStyle?: MarkerStyle

Defined in: ui/src/tree/tree.ts:46

The expand-marker style (default 'tv' — a faithful single +/─). 'brackets' draws [+]/[-] (pure ASCII, the most legible); 'triangle' draws ▸/▾ and falls back to 'brackets' on a terminal without Unicode. Only the marker column changes — indentation and connectors are identical across styles.


onSelect? ​

optional onSelect?: (index, node) => void

Defined in: ui/src/tree/tree.ts:33

Activation callback (Enter / text double-click); index is the flattened index, node the node.

Parameters ​

index ​

number

node ​

TreeNode<T>

Returns ​

void


roots ​

roots: Signal<TreeNode<T>[]>

Defined in: ui/src/tree/tree.ts:25

The reactive forest of root nodes; a single-root tree is the 1-element case.


selected? ​

optional selected?: Signal<number>

Defined in: ui/src/tree/tree.ts:31

The selected (chosen) flattened-visible index (default an internal signal at -1).