Officina UI
Components

TreeList

Hierarchical data grid — rows expand/collapse in place while staying aligned

TreeList is a multi-column data grid for hierarchical rows: each row can have children, and the first column gets a chevron to expand or collapse branches in place while the other columns stay aligned. Use it for file trees, BOMs, nested categories, or org data you want to scan as a table. Define columns (with optional per-cell render), pass nested rows, and seed initial state with defaultExpandAll or defaultExpandedIds. Row clicks fire onRowClick, and selectedId highlights the active row.

Example

Preview
NameOwnerSize
srcplatform—
componentsdesign1.2 MB
libplatform420 KB
package.jsonplatform4 KB
import { TreeList } from '@officina/ui';

function FileTree() {
  return (
    <TreeList
      defaultExpandAll
      columns={[
        { key: 'name', header: 'Name' },
        { key: 'size', header: 'Size', align: 'right' },
      ]}
      rows={[
        {
          id: 'src',
          name: 'src',
          size: '—',
          children: [{ id: 'app', name: 'app.tsx', size: '4 KB' }],
        },
      ]}
    />
  );
}

API

PropTypeDefaultDescription
columns*TreeListColumn<R>[]—Column definitions describing how to render each cell.
rows*R[]—Hierarchical row data; each row may carry nested children.
defaultExpandAllbooleanfalseExpand every branch initially.
defaultExpandedIdsstring[]—Ids of branches expanded on first render.
emptyMessagestringNo dataText shown when there are no rows.
onRowClick(row: R) => void—Called when a row is clicked.
selectedIdstring—Highlighted row id.

On this page