Skip to content

Tree List

@astryxdesign/core v0.7.1 · TreeList

Props ​

NameTypeDefaultDescription
itemsTreeListItemData[]-The tree. See the item fields below.
density'compact' | 'balanced' | 'spacious''balanced'Block padding of a row: 4px, 8px, or 12px.
variant'lineGuides' | 'noGuides''lineGuides'Whether parent and child rows are joined by a guide line.
headerstring-Plain title above the tree. Use the header slot for rich content.
labelstring-Accessible name of the tree when there is no visible header.

TreeListItemData ​

FieldTypeDescription
idstringStable identity for focus and expansion.
labelstringVisible name.
descriptionstringSecondary line.
iconstringLeading glyph name, or a CSS icon class starting with i-.
endIconstringTrailing glyph or CSS icon class.
badgestringTrailing count.
childrenTreeListItemData[]Nested items. Present means the row can expand.
href / targetstringRenders the row as a link. target="_blank" adds rel="noopener noreferrer".
onClick(event: MouseEvent) => voidRenders a leaf as a button.
isDisabledbooleanThe row does not take focus or activation.
isSelectedbooleanCallers mark the current item. The tree has no root selection value and does not force a single selected row.
isExpandedbooleanStarting expansion. Later toggles are owned by the tree.
classNamestringExtra class on that row.
styleCSSPropertiesInline style on that row.

The start and end slots receive { item } and replace icon and endIcon.

A row's accessible name is its label. The description is exposed with aria-describedby, so the chevron and icons stay out of the name. Typeahead matches the label only. A visible header names the tree and wins over a passed aria-label. A keydown listener on the root that calls preventDefault keeps arrow keys from moving focus inside the tree.

Theming ​

Indent is --astryx-spacing-4. Row content uses --astryx-spacing-2 of inline padding and the same gap. The guide is a 1px emphasized border. Focus uses the shared focus outline tokens. A selected row uses the accent muted fill.