Hierarchical tree built on ul/li with states, shapes, densities, indent modes, node styles, grouping, checkboxes, notes, toggle expansion, and dynamic colors.
ul > li. Each row is div[data-role="node"] containing div[data-role="content"] > span[data-role="label"] and optionally span[data-role="arrow"], .check + input, div[data-role="note"], span[data-role="spacer"], div[data-role="custom"].div[data-role="children"] > ul placed right after the node row. The top-level ul does not need a data-role="children" wrapper.ul/li inside non-list nodes.span[data-role="arrow"] to keep indentation consistent; the arrow content is hidden automatically for leaf nodes..tree-expanded (one branch), .tree-expanded-n (up to level n), or .tree-expanded-all (all) to expand, or a <input data-role="toggle" type="checkbox"> for interactive CSS-only toggling.div[data-role="group"] as a non-selectable section label; its indentation aligns with its child nodes..tree-selected colors the whole row, .tree-active colors only the label, and .tree-disabled disables a row or the root.<input> inside span[data-role="label"]..tree-expanded on node).tree-expanded-all).tree-expanded-1 ~ .tree-expanded-3).tree-selected) — colors the whole row.tree-active) — colors only the label.tree-disabled) — single node or root.tree-hoverable)input[data-role="toggle"]) — CSS-only expand/collapse<input>.check + input)div[data-role="note"])All data-role="node" elements should carry a data-role="arrow" child — even leaf nodes — to keep indentation consistent.
.tree-padded)The group's label indentation aligns with its child nodes. Groups use div[data-role="group"] as a non-selectable section header.
Child nodes of a group must share the same --tree-level to keep indentation consistent.
.tree-square).tree-rounded).tree-pill).tree-tight).tree-snug).tree-compact).tree-relaxed).tree-loose).tree-indent-cascading) — default.tree-indent-dedicated) — requires --tree-level and span[data-role="indent"].tree-btns).tree-entries) — fully expanded, check icon on selected.tree-primary).tree-success).tree-warning).tree-error)