Kinetik UI

Tree View

.md

Nested folders whose branches grow open to their measured height as the chevron turns and rows drift in.

v1.0.0Live on webreact-native-reanimatedreact-native-worklets
Component preview

Installation

Kinetik CLI
npx kinetik-ui add tree-view

The CLI copies the source and installs native dependencies with npx expo install, so versions match your Expo SDK. With shadcn: npx shadcn@latest add https://kinetik-ui.dev/r/tree-view.json

Install manually

  1. Install dependencies
    npx expo install react-native-reanimated react-native-worklets
  2. Copy the source files
    • components/kinetik/tree-view.tsx
    View source files

Usage

import { TreeView } from '@/components/kinetik/tree-view';

<TreeView
  data={[
    {
      id: 'app',
      label: 'app',
      children: [{ id: 'home', label: 'index.tsx', detail: '4 KB' }],
    },
  ]}
  defaultExpanded={['app']}
  selected={current}
  onSelect={(node) => setCurrent(node.id)}
/>;

When to use

  • Hierarchies people browse a level at a time: folders, categories, an outline, settings groups.
  • Places where seeing the path to an item helps, not just the item.

When not to use

  • Flat lists. Use plain rows.
  • Deep trees on a phone (more than three or four levels). Drill into a new screen per level instead.

Notes

  • A branch grows to its measured height while its rows drift in; nested branches resize their parents as they open.
  • Children are built the first time a branch opens and kept afterwards, so large trees stay cheap.
  • Every row is a button; branches say whether they are expanded and the selected row says it is selected.
  • With reduced motion branches open and close at once.

Props

TreeViewProps

PropTypeDefaultDescription
datarequiredreadonly TreeNode[]—
defaultExpandedreadonly string[][]Branches open at first.
selectedstring—The highlighted node.
onSelect(node: TreeNode) => void—Called for a press on any node; branches also open or close.
hapticsbooleantrueA tick when a branch opens or closes. Defaults to true.
testIDstring—
styleStyleProp<ViewStyle>—

Performance and accessibility

Performance

Budget
Plain views; each open branch springs one height value. Children are built on first open. Nothing runs at rest.
Measured

Pixel 9 emulator, API 35, release build · interaction median 0.94× the system Settings app on the same emulator (indicative only) · no frames drawn at rest · 152 MB app memory

Real-device measurement pending.

Accessibility

Reduced motion
Branches open and close at once.
Screen readers
Every row is a button with its label and detail; branches report expanded or collapsed, and closed branches are hidden.
Touch target
Rows are 44 pt tall and span the full width.

Source files

components/kinetik/tree-view.tsx is in the Code tab of the preview above.