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/aBureau · n/aDépréciéNavigation
Niveau de support
Déprécié
Taille
5.0 kB gzip, budget 2.5 kB
Qui l'utilise
3 fichiers des produits et sites en production l'importent Compté dans l'inventaire daté du 2026-11-23.
import { TreeView } from "@krizaka/ui/tree-view";

Web uniquement — React, depuis @krizaka/ui/tree-view. Déprécié : conservé pour les apps qui l'utilisent encore, retiré à sa prochaine version majeure.

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

Pourquoi il est là. No product uses it and no planned work needs it: the documentation tree is Fumadocs' and the datasets screens drill down with a list.

DépréciéDepuis 3.6.0, retiré en 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. Utiliser à la place : List.

Quand l’utiliser

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

Quand ne pas l’utiliser

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

Installation

Installer

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

Styles

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

Importer

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

Exemples

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.

PropTypeDéfautDescription
aria-labelrequisstring—The tree's accessible name (“Documentation”).
nodesrequisreadonly 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).

Accessibilité

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

Clavier

TouchesAction
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.

Bonnes pratiques

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

Générée depuis le code de @krizaka/ui 5.3.4 : son meta.ts, ses exemples et ses types.Modifier cette documentation sur GitHub

Sur cette page