Skip to content
Display

Tree View

Data-driven, accessible hierarchy with keyboard navigation.

Import

tsx
import { TreeView } from "@cronus-ui/ui";
bash
npx cronus-ui add tree-view

Examples

.cronus

The same component declared in Cronus. Emitted at build time from the audit fixtures — the kernel renders it as HTML with no React.

PortedParity: MatchGeometry 1/1Pixel diff 0 pxLogic 1/1Parity scoreboard
default.cronus
app "audit-fixtures" {
  port 5176
}

style {
  preset aurora
  theme dark
}

component TreeViewDefault layout:inline style:tree-view {
  aria-label:"Files"
  label "Files"
  text "src"
  text "README.md"
}

page "/audit/tree-view/default" type:custom {
  use TreeViewDefault
}

API Reference

Generated from the component's exported types.

TreeViewProps

Extends Omit<HTMLAttributes<HTMLDivElement>, "onChange">

Skip TreeViewProps props table
PropTypeDefaultDescription
data*
TreeNode[]—The hierarchy to render.
value
string—Controlled selected node id.
defaultValue
string—Initial selected node id for the uncontrolled case.
onValueChange
(id: string) => void—Called when the selection changes (controlled or not).
expandedIds
string[]—Controlled set of expanded branch ids.
defaultExpandedIds
string[]—Initial expanded branch ids for the uncontrolled case.
onExpandedChange
(ids: string[]) => void—Called whenever the expanded set changes (controlled or not).
aria-label
string—Accessible label for the tree landmark.
className
string—Additional class names merged onto the root.
children
ReactNode—Contents of the component.
id
string—DOM id of the root element.