Skip to content

Hierarchical rows in columns: expand and collapse rows, sort siblings, filter every column with the Excel-style menu and search across columns, with the same matching rules as the Data Grid (the shared grid-core engine). Use it for file trees, org charts, bills of materials or any data with parent and child rows.

atlas-tree-grid

Examples

File tree

Root rows in dataSource , children under children , a unique rowId across all levels. initiallyExpanded opens the roots on the first data, [(expandedKeys)] holds the open rows, and format writes a cell's text. Sort from a header, filter from its funnel button; with the keyboard, Right and Left open and close rows (WAI-ARIA treegrid).

src
Folder412 KB
main.ts
TypeScript2 KB
docs
Folder96 KB
README.md
Markdown18 KB
package.json
JSON3 KB

Open rows: src, docs

Search and hierarchy modes

Bind your own search box to search . filterHierarchy decides which relatives of a match stay: ancestors (the path to the root, the default), descendants (its subtree), both , or none . Rows kept only to show matches below them open on their own without changing expandedKeys ; collapsing one holds until the search changes.

Engineering
Ana Pop42
Platform
Radu Ionescu18
Billing services
Ioan Stan11
Finance
Vlad Matei9
Billing operations
Dana Lungu4

Selecting branches

selectionMode="multiple" adds a check box to the tree column; checking a row checks its descendants, and a row with only some of them checked shows a dash. [(selectedKeys)] holds the keys at every level, expanded or not. With the keyboard, Space selects the focused row.

Billing
Module
View invoices
Read
Issue refunds
Write
Users
Module
View members
Read
Invite members
Write
Remove members
Admin
Granted: billing.read

API

Generated from the library source, so it always matches the code.

AtlasTreeGridComponent atlas-tree-grid

InputTypeDefaultDescription
dataSource requiredT[], T[] | null | undefined— Root rows. null / undefined count as no rows.
columns requiredTreeGridColumn<T>[]— Column definitions, in display order.
rowId requiredstring | ((row: T) => unknown)— Row identity, unique across all levels: a field name or a function. Expansion is kept by it.
children string | ((row: T) => readonly T[] | null | undefined)'children' Where a row's children are: a field name (default 'children' ) or a function. Missing = leaf.
treeColumn string | nullnull Field of the column that shows the indent and the expand toggle. Default: the first column.
expandedKeys two-wayReadonlySet<unknown>new Set() Keys ( rowId ) of the expanded rows; two-way. Rows the filters open for you are not added.
initiallyExpanded TreeGridInitialExpansion'none' Rows expanded on the first data, when expandedKeys is still empty: 'none' , 'all' , or a depth ( 1 opens the roots, 2 also their children…).
sortable booleantrue Enables sorting from the headers (a column's own sortable: false wins). Siblings are sorted at every level.
sort SortState | nullnull Active sort; the grid resets to it whenever the bound value changes.
filterable booleantrue Enables the Excel filter in every header (a column's own filterable: false wins).
filters FilterState[][] Active column filters; the grid resets to them whenever the bound value changes.
search string'' Text matched case-insensitively against every filterable column. Bind it to your own search box.
filterHierarchy GridTreeFilterMode'ancestors' Which relatives of a matching row stay visible. Default 'ancestors' : the path to the root.
selectionMode TreeGridSelectionMode'none'single selects the clicked row; multiple adds check boxes, and checking a row checks its descendants.
selectedKeys two-wayReadonlySet<unknown>new Set() Keys ( rowId ) of the selected rows, at any level and expanded or not; two-way.
dense booleanfalse Smaller cell padding.
striped booleanfalse Alternates the background of rows.
maxHeight string | null | undefinedundefined Maximum height (any CSS length); the body scrolls beyond it and the header stays visible. Unset, it is 70vh , so a long tree scrolls inside the grid instead of scrolling the header off screen. null lets the grid grow with its rows (the page scrolls).
emptyText string'' Text shown when there are no rows. Defaults to the locale's treeGrid.emptyText .
ariaLabel string | undefinedundefined Accessible name. Defaults to the locale's treeGrid.ariaLabel .
locale Partial<TreeGridLocale>— Overrides some texts of this grid; the rest come from the configured locale ( treeGrid ).
class string'' Extra CSS classes, merged with the component's own through cn() ; yours win on conflicts.
OutputPayloadDescription
sortChangeTreeGridSortEvent Emits when the user changes the sort.
filterChangeTreeGridFilterEvent Emits the column filters after the user changes one.
rowClickTreeGridRowClickEvent<T> Emits when a row is clicked, or when Enter is pressed on a row without children.
selectionChangeTreeGridSelectionEvent<T> Emits the selected rows after the user changes the selection, or after clearSelection() .

Types

TreeGridCellContext

Template context of a cellTemplate .

PropertyTypeDescription
$implicit T The row.
value unknown The cell's raw value.
column TreeGridColumn<T> —
level number 1-based depth of the row as shown.
hasChildren boolean —
expanded boolean —

TreeGridColumn

A column of atlas-tree-grid . It satisfies the grid engine's GridEngineColumn .

PropertyTypeDescription
field keyof T & string Key of the value in the row.
header string Header label.
type? 'text' | 'number' | 'date''number' and 'date' change how values compare, match filters and align. Default: text.
width? string CSS width, e.g. '160px' .
align? 'left' | 'center' | 'right' Text alignment of the header and cells; numbers default to 'right' .
sortable? booleanfalse turns sorting off for this column (when the grid is sortable ).
filterable? booleanfalse turns the Excel filter and the search off for this column (when the grid is filterable ).
filter? { options?: GridFilterOption[] } Excel filter options: options replaces the computed value list.
format? (value: unknown, row: T) => string Text of a cell (also what the search and the value list show). Default: String(value) .
cellTemplate? TemplateRef<TreeGridCellContext<T>> Custom cell content. In the tree column it renders after the indent and the expand toggle.

TreeGridFilterEvent

atlas-tree-grid filterChange .

PropertyTypeDescription
filters FilterState[] —

TreeGridInitialExpansion

How much of the tree initiallyExpanded opens: none, every row, or the rows down to a depth (1 = roots).

type TreeGridInitialExpansion = 'none' | 'all' | number

TreeGridRowClickEvent

atlas-tree-grid rowClick .

PropertyTypeDescription
row T —
level number 1-based depth of the row as shown.
event MouseEvent | KeyboardEvent The click, or the Enter key press on a row without children.

TreeGridSelectionEvent

atlas-tree-grid selectionChange .

PropertyTypeDescription
selected T[] The selected rows, in tree order (expanded or not).
keys ReadonlySet<unknown> Their keys ( rowId ), the same set as selectedKeys .

TreeGridSelectionMode

atlas-tree-grid selectionMode : no selection, one row, or several rows with checkboxes.

type TreeGridSelectionMode = 'none' | 'single' | 'multiple'

TreeGridSortEvent

atlas-tree-grid sortChange .

PropertyTypeDescription
sort SortState | null —