Zephora UI

Data

TreeTable

Hierarchical table (treegrid): rows nest via children, the first column indents by depth and carries an expand/collapse toggle.

Import

import { TreeTable } from "@zephora/react";

Examples

Basic

NameKindSize
srcFolder44 KB
index.tsFile1 KB
LICENSEFile2 KB

Controlled expansion

Drive `expandedKeys` yourself to build expand-all / collapse-all actions.

NameKindSize
LICENSEFile2 KB

API

TreeTable props

PropTypeDefaultDescription
columns *TreeTableColumn[]—Column definitions.
data *TreeTableRow[]—Root rows; nesting comes from each row's `children`.
expandedKeysstring[]—Controlled expanded row keys.
defaultExpandedKeysstring[][]Uncontrolled initial expanded row keys.
onExpandedChange(keys: string[]) => void—Fires with the full set of expanded keys.
unstyledbooleanfalseHeadless mode — skips Zephora styling.

TreeTableColumn props

PropTypeDefaultDescription
key *string—Unique column id, matched against `row.cells`.
header *ReactNode—Header cell content.
widthnumber | string—Fixed column inline-size.
align"start" | "center" | "end"—Cell text alignment.

TreeTableRow props

PropTypeDefaultDescription
key *string—Unique row key.
cells *Record<string, ReactNode>—Cell content per column key.
childrenTreeTableRow[]—Nested rows; presence adds the expand/collapse toggle.