Krizaka UI
Krizaka UI

Tree view

A hierarchy the keyboard walks — the ARIA tree: one tab stop, the arrows move and open, a letter jumps, branches load on demand.

Web · ✓Mobile · n/aDesktop · n/aDeprecatedNavigation
Support level
Deprecated
Size
5.0 kB gzip, budget 2.5 kB
Who uses it
3 files of the live products and sites import it Counted in the dated inventory of 2026-11-23.
import { TreeView } from "@krizaka/ui/tree-view";

Web only — React, from @krizaka/ui/tree-view. Deprecated: kept for the apps that still use it, removed in its next major.

  • Mobile · n/a. Deprecated: no product uses it.
  • Desktop · n/a. Deprecated: no product uses it.

Why it is here. No product uses it and no planned work needs it: the documentation tree is Fumadocs' and the datasets screens drill down with a list.

DeprecatedSince 3.6.0, removed in 4.0.0. No product uses it and no planned work needs it: the documentation tree is Fumadocs' and the datasets screens drill down with a list. Use instead: List.

When to use

  • The documentation's sections (krizaka.com/docs).
  • A studio's datasets, folders of files.

When not to use

  • For two levels or fewer: a list with headings reads better.Use instead: List
  • On a phone: drill down screen by screen with a list.Use instead: List

Installation

Install

npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcss

Styles

@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";

Import

import { TreeView } from "@krizaka/ui/tree-view";

Examples

Documentation

Products, sections and pages, the current page selected.

Loaded on demand

A branch fetches its files when it opens.

Props

A hierarchy to browse — documentation sections, a studio's datasets, folders: one tab stop, the arrows walk it (→ opens, ← closes or goes up), Home/End, a letter jumps to the next name; branches can load their children on demand.

PropTypeDefaultDescription
aria-labelrequiredstring—The tree's accessible name (“Documentation”).
nodesrequiredreadonly TreeNode[]—The roots.
classNamestring—Classes merged on the tree.
defaultExpandedreadonly string[][]The ids open at first, uncontrolled.
defaultSelectedstring | nullnullThe selected node at first, uncontrolled.
expandedreadonly string[]—The ids of the open branches (controlled).
loadingLabelstringLoadingThe words of a branch that is loading (“Loading”).
onExpandedChange((expanded: string[]) => void)—Called with the open branches.
onLoadChildren((node: TreeNode) => void)—Called when a branch with hasChildren and no children opens: fetch them, then pass them in nodes.
onSelect((node: TreeNode) => void)—Called when a node is chosen (click, Enter or Space): navigate, open the file.
selectedstring | null—The selected node (controlled).

Accessibility

  • tree, treeitem and group with level, position and size; a loading branch is busy.
  • Web only: a phone drills down with lists.

Keyboard

KeysAction
Arrow Down / Arrow UpMove to the next or previous visible node.
Arrow RightOpens a closed branch, or moves to its first child.
Arrow LeftCloses an open branch, or moves to its parent.
Home / EndMove to the first or last visible node.
Enter / SpaceSelect the node (onSelect).
A letterMoves to the next node whose name starts with it.

Best practices

  • Open the branch of the selected node at first (defaultExpanded).
  • Load big branches on demand (hasChildren + onLoadChildren).

Generated from the code of @krizaka/ui 5.3.4: its meta.ts, its examples and its types.Edit this documentation on GitHub

On this page