Skip to content
THE COMPONENT LIBRARY
Skip to content

Component reference

TreeTable

A folder hierarchy with columns and controlled selection.

Preview

Live preview

Changes apply to this preview only.

Select a file with its checkbox, a row click or Space
Project files
NameTypeSizeModified
srcFolder—Oct 20, 2026
componentsFolder—Oct 19, 2026
button.tsxTypeScript4.2 kBOct 18, 2026
data-grid.tsxTypeScript18.4 kBOct 20, 2026
tree-table.tsxTypeScript14.7 kBOct 20, 2026
index.tsTypeScript1.2 kBOct 20, 2026
packagesFolder—Oct 18, 2026
package.jsonJSON3.2 kBOct 18, 2026
README.mdMarkdown8.9 kBOct 14, 2026

Width adapts to the available space

More examples

Different configurations and compositions using the real Pimolu API. Each preview runs independently and follows the site appearance.

Controlled row selection

Select nested rows while the application owns the selected ids.

Open preview

Controlled expansion

expandedIds and onExpandedChange move the expansion state to the page so toolbar actions can expand or collapse the whole hierarchy. The expanders still work and report every change.

Open preview

Dense audit tree

defaultExpandAll opens every branch on first render, and density='sm' keeps a long audit trail compact. Disabled nodes keep their place but cannot be expanded or selected.

Open preview

Usage

Stable row ids preserve expansion and selection across data updates.

API reference

Generated from the public TypeScript declarations. Native HTML attributes are inherited where the component extends them; this reference includes Pimolu props and selected common native attributes.

PimoluTreeTableNode

Type source
PimoluTreeTableNode public API
NameTypeDefaultDescription
idRequiredstring—Unique node identity, also used as the default React key.
labelReactNode—Fallback content of the first (tree) column.
childrenreadonly PimoluTreeTableNode[] | undefined—Nested children. Their depth drives `aria-level` and the indent guides.
disabledboolean | undefined—Prevents expansion and selection for this row.
idRequired

string

No default extracted.

Unique node identity, also used as the default React key.

label

ReactNode

No default extracted.

Fallback content of the first (tree) column.

children

readonly PimoluTreeTableNode[] | undefined

No default extracted.

Nested children. Their depth drives `aria-level` and the indent guides.

disabled

boolean | undefined

No default extracted.

Prevents expansion and selection for this row.

PimoluTreeTableColumn

Type source
PimoluTreeTableColumn public API
NameTypeDefaultDescription
idRequiredstring—Stable column id, also used as the fallback node property key.
headerRequiredReactNode—Visible header content.
labelstring | undefined`header`Plain-text column name for accessible labels. Defaults to `header`.
cell((node: T) => ReactNode) | undefined—Renders the cell content. On the tree column, the expander and the guides are prepended automatically.
alignPimoluTreeTableAlign | undefined"start"Cell and header alignment. Defaults to "start".
widthProperty.Width<string | number> | undefined—Optional fixed width (number of pixels or any CSS width).
idRequired

string

No default extracted.

Stable column id, also used as the fallback node property key.

headerRequired

ReactNode

No default extracted.

Visible header content.

label

string | undefined

Default: `header`

Plain-text column name for accessible labels. Defaults to `header`.

cell

((node: T) => ReactNode) | undefined

No default extracted.

Renders the cell content. On the tree column, the expander and the guides are prepended automatically.

align

PimoluTreeTableAlign | undefined

Default: "start"

Cell and header alignment. Defaults to "start".

width

Property.Width<string | number> | undefined

No default extracted.

Optional fixed width (number of pixels or any CSS width).

PimoluTreeTableLabels

Type source
PimoluTreeTableLabels public API
NameTypeDefaultDescription
expandRequired(label: string) => string—Accessible label of a collapsed expander.
collapseRequired(label: string) => string—Accessible label of an expanded expander.
selectRowRequired(label: string) => string—Accessible label of a row checkbox.
selectAllRequiredstring—Accessible label of the header select-all checkbox.
emptyRequiredstring—Shown when the tree has no node.
expandRequired

(label: string) => string

No default extracted.

Accessible label of a collapsed expander.

collapseRequired

(label: string) => string

No default extracted.

Accessible label of an expanded expander.

selectRowRequired

(label: string) => string

No default extracted.

Accessible label of a row checkbox.

selectAllRequired

string

No default extracted.

Accessible label of the header select-all checkbox.

emptyRequired

string

No default extracted.

Shown when the tree has no node.

PimoluTreeTableProps

Type source
PimoluTreeTableProps public API
NameTypeDefaultDescription
nodesRequiredreadonly T[]—Root nodes. The tree is never mutated.
columnsRequiredreadonly PimoluTreeTableColumn<T>[]—Column definitions. The first column is the tree column.
getNodeId((node: T) => string) | undefined`node.id`, which must be unique in the treeNode identity. Defaults to `node.id`, which must be unique in the tree. Provide this when an external id lives outside `id`.
getNodeLabel((node: T) => string) | undefinedthe text of the tree column, then `node.id`Full accessible label of a node, used by the expander and the row checkbox. Defaults to the text of the tree column, then `node.id`.
captionReactNode—Visible table caption, also used as the accessible name.
ariaLabelstring | undefined—Accessible name when no caption is rendered.
expandedIdsreadonly string[] | undefined—Controlled expanded node ids.
defaultExpandedIdsreadonly string[] | undefinednoneInitial expanded node ids when uncontrolled. Defaults to none.
defaultExpandAllboolean | undefinedfalseExpands every node that has children on first render.
onExpandedChange((expandedIds: string[]) => void) | undefined—Called with the next expanded ids, in expansion order.
selectableboolean | undefinedfalseAdds the selection column and enables `aria-selected`.
selectedIdsreadonly string[] | undefined—Controlled selected node ids.
defaultSelectedIdsreadonly string[] | undefined—Initial selection when uncontrolled.
onSelectionChange((selectedIds: string[]) => void) | undefined—Called with the next selection, ordered like the whole tree.
densityPimoluTableDensity | undefined"md"Row density. Defaults to "md".
labelsPartial<PimoluTreeTableLabels> | undefined—Overrides individual chrome labels.
emptyStateReactNode—Replaces the default empty message.
classNamestring | undefined—Additional class names on the root.
rowClassName((node: T, level: number) => string | undefined) | undefined—Additional class names per row.
nodesRequired

readonly T[]

No default extracted.

Root nodes. The tree is never mutated.

columnsRequired

readonly PimoluTreeTableColumn<T>[]

No default extracted.

Column definitions. The first column is the tree column.

getNodeId

((node: T) => string) | undefined

Default: `node.id`, which must be unique in the tree

Node identity. Defaults to `node.id`, which must be unique in the tree. Provide this when an external id lives outside `id`.

getNodeLabel

((node: T) => string) | undefined

Default: the text of the tree column, then `node.id`

Full accessible label of a node, used by the expander and the row checkbox. Defaults to the text of the tree column, then `node.id`.

caption

ReactNode

No default extracted.

Visible table caption, also used as the accessible name.

ariaLabel

string | undefined

No default extracted.

Accessible name when no caption is rendered.

expandedIds

readonly string[] | undefined

No default extracted.

Controlled expanded node ids.

defaultExpandedIds

readonly string[] | undefined

Default: none

Initial expanded node ids when uncontrolled. Defaults to none.

defaultExpandAll

boolean | undefined

Default: false

Expands every node that has children on first render.

onExpandedChange

((expandedIds: string[]) => void) | undefined

No default extracted.

Called with the next expanded ids, in expansion order.

selectable

boolean | undefined

Default: false

Adds the selection column and enables `aria-selected`.

selectedIds

readonly string[] | undefined

No default extracted.

Controlled selected node ids.

defaultSelectedIds

readonly string[] | undefined

No default extracted.

Initial selection when uncontrolled.

onSelectionChange

((selectedIds: string[]) => void) | undefined

No default extracted.

Called with the next selection, ordered like the whole tree.

density

PimoluTableDensity | undefined

Default: "md"

Row density. Defaults to "md".

labels

Partial<PimoluTreeTableLabels> | undefined

No default extracted.

Overrides individual chrome labels.

emptyState

ReactNode

No default extracted.

Replaces the default empty message.

className

string | undefined

No default extracted.

Additional class names on the root.

rowClassName

((node: T, level: number) => string | undefined) | undefined

No default extracted.

Additional class names per row.

Accessibility

  • Test expand/collapse and row selection by keyboard; ensure hierarchy and column context are announced.
Read the accessibility guide →