Skip to content
THE COMPONENT LIBRARY
Skip to content

Component reference

TreeView

Browse an application-controlled file hierarchy.

Preview

Live preview

Changes apply to this preview only.

tabsexpanded: src, components
  • src
  • components
  • button.tsx
  • card.tsx
  • tabs.tsx
  • App.tsx
  • styles.css
  • README.md
  • package.json

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 document selection

Application state follows a selected document; expansion stays independent.

Open preview

File tree

Click a folder to select and toggle it; disabled nodes are skipped by the keyboard.

Open preview

Disabled branch

A disabled node keeps its label but cannot be selected or focused.

Open preview

Usage

Separate expansion from selection and use stable ids when nodes are updated.

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.

PimoluTreeItem

Type source
PimoluTreeItem public API
NameTypeDefaultDescription
idRequiredstring—Public Pimolu prop; see the source declaration for details.
labelRequiredReactNode—Visible label associated with the control.
childrenreadonly PimoluTreeItem[] | undefined—Public Pimolu prop; see the source declaration for details.
disabledboolean | undefined—Public Pimolu prop; see the source declaration for details.
idRequired

string

No default extracted.

Public Pimolu prop; see the source declaration for details.

labelRequired

ReactNode

No default extracted.

Visible label associated with the control.

children

readonly PimoluTreeItem[] | undefined

No default extracted.

Public Pimolu prop; see the source declaration for details.

disabled

boolean | undefined

No default extracted.

Public Pimolu prop; see the source declaration for details.

PimoluTreeViewProps

Type source
PimoluTreeViewProps public API
NameTypeDefaultDescription
itemsRequiredreadonly PimoluTreeItem[]—Public Pimolu prop; see the source declaration for details.
expandedIdsreadonly string[] | undefined—Controlled expanded ids.
defaultExpandedIdsreadonly string[] | undefined[]Initial expanded ids when uncontrolled.
onExpandedChange((ids: string[]) => void) | undefined—Public Pimolu prop; see the source declaration for details.
selectedIdstring | undefined—Controlled selected id.
defaultSelectedIdstring | undefined—Initial selected id when uncontrolled.
onSelectedChange((id: string | undefined) => void) | undefined—Public Pimolu prop; see the source declaration for details.
aria-labelRequiredstring—Accessible name of the tree.
classNamestring | undefined—Public Pimolu prop; see the source declaration for details.
itemsRequired

readonly PimoluTreeItem[]

No default extracted.

Public Pimolu prop; see the source declaration for details.

expandedIds

readonly string[] | undefined

No default extracted.

Controlled expanded ids.

defaultExpandedIds

readonly string[] | undefined

Default: []

Initial expanded ids when uncontrolled.

onExpandedChange

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

No default extracted.

Public Pimolu prop; see the source declaration for details.

selectedId

string | undefined

No default extracted.

Controlled selected id.

defaultSelectedId

string | undefined

No default extracted.

Initial selected id when uncontrolled.

onSelectedChange

((id: string | undefined) => void) | undefined

No default extracted.

Public Pimolu prop; see the source declaration for details.

aria-labelRequired

string

No default extracted.

Accessible name of the tree.

className

string | undefined

No default extracted.

Public Pimolu prop; see the source declaration for details.

Accessibility

  • Verify the tree's arrow-key model, focus position and disabled branches.
Read the accessibility guide →