ZUI

Search documentation

Find a page or a heading.

File Tree

An accessible file tree that drives keyboard navigation and owns selection and folder expansion, controlled or uncontrolled.

tsx

Installation

bash

Usage

tsx

The consumer composes FileTreeItem / FileTreeLabel / FileTreeGroup and owns every visible label and icon; the root ships no copy, so give it an aria-label:

tsx

File Tree and TreeItem (data-display/tree-item) draw a similar row, and stay separate families until a change shows the two move together.

Composition

text

API reference

FileTree

Renders a ul and takes every prop a ul takes except onSelect, plus:

A WAI-ARIA APG Tree View (compound + context): the root owns selection and folder expansion, each controlled or uncontrolled, and drives keyboard navigation (Up/Down/Home/End move, Left/Right collapse/expand, Enter/Space select). It sets data-slot="file-tree" and role="tree".

FileTreeItem

Renders a li and takes every prop a li takes, plus:

A node in a FileTree. It is a folder when it contains a FileTreeGroup (then it carries aria-expanded), otherwise a leaf. It sets data-slot="file-tree-item" and data-value to its value.

FileTreeLabel

Renders a div and takes every prop a div takes. The clickable row of a FileTreeItem: a chevron (folders only, its animated icon playing while the row is hovered or its item focused), then the consumer's icon and file name as children, indented by depth. Clicking selects the item and toggles a folder. It sets data-slot="file-tree-label" and data-selected while selected.

FileTreeGroup

Renders a ul and takes every prop a ul takes. The nested children of a folder FileTreeItem; rendered only while its parent item is expanded, and deepens aria-level for its descendants. It sets data-slot="file-tree-group" and role="group".