Skip to main content

Basic

data is a flat list: every row has an id, and a child names its parent. The component works out the level of every row and whether it has children, and every parent starts closed. A parent has a button with aria-expanded that opens and closes it; a row shows when none of its ancestors is closed. The first field is the tree column: the button, the icon, and the content, indented by level, with “Level 2:” for a screen reader. format builds the content of a cell (here the star of the department lead). The caption has markup (the caption slot), and the header stays in view (sticky-header).

Departments and their teams
NameHeadMembersBudget
Level 1: Engineering
Priya Nair48$4.2M

Icons and expand all

icon on a row puts an icon in the tree column (full Font Awesome classes), so a folder looks different from a file. expand-actions adds Expand all and Collapse all, which open or close every parent of the table; the toolbar slot adds a button next to them. The Name column is sticky (sticky: 'left' in fields), and the foot slot holds a total that stays at the bottom (sticky-footer).

Files and folders
NameSizeModified
Level 1: Documents
—Nov 10, 2026
Level 1: Images
—Nov 2, 2026
Level 1: readme.txt
3 KBSep 9, 2026
Total 9 items

Lazy loading

A lazy row has no children yet. The first time it opens, the table shows Loading…, sets aria-busy, and sends tree-load with the row id. The page adds the child rows and answers with tree-loaded; an empty folder says so, and tree-failed shows Could not load this folder. with Try again (the Archive folder fails once, so you can see it). This page adds the rows with a small script; replace fetchChildren() with your own request.

Files with lazy loading
NameSizeModified
Level 1: Documents
—Nov 10, 2026
Level 1: Images
—Nov 2, 2026
Level 1: Archive
—Dec 31, 2025
Level 1: Drafts
—Aug 1, 2026
Level 1: readme.txt
3 KBSep 9, 2026

Selection

selectable puts a checkbox on every row and one in the header. Checking a parent checks all its descendants; a parent with only some checked rows is mixed (indeterminate, read as “partially checked”). The status above the table counts the checked rows and is announced (aria-live="polite"). This table is compact and bordered.

0 of 9 rows selected

Product categories
CategoryProductsIn stock
Level 1: Electronics
1421,180
Level 1: Accessories
962,040
Level 1: Storage
54530

Options reference

The props of sk-tree-table, the fields of a row, and the events of lazy rows. Every attribute that is not a prop goes to the <table>.

Name Kind Meaning
fields Prop The columns, { key, text, align, sticky, format }; the first one is the tree column.
data Prop A flat list of rows: id, parent, icon, lazy, and the column values by key.
selectable, expand-actions Flags The checkboxes with the status, and the Expand all and Collapse all buttons.
caption, variant, density, sticky-header, sticky-footer, striped, hover, bordered Props The look, as on the Tables page.
tree-load Event from the table A lazy row opened for the first time: detail.id.
tree-loaded, tree-failed Events to the table The children of detail.id were added, or could not be loaded.