Getting StartedInstallation and setup guides 5
LayoutWorkflow and structural layout components 7
OverlayModal and floating layer surfaces 3
FeedbackStatus, empty, progress, and loading placeholder patterns 5
FormInput and selection components 17
UtilityGeneral-purpose interface utilities 7
NavigationMenu surfaces and hierarchical actions 7

Styling contract

Style against explicit data hooks from tree primitives and the component's CSS classes. Use data-slot and data-* attributes for state-driven styling.

Primitive data hooks

HookElementUse
data-slot="tree"RootContainer styling, orientation layout.
data-slot="tree-item"NodeRow layout, padding, cursor.
data-slot="tree-group"Children containerIndentation, border-left connector.
data-slot="tree-indicator"Disclosure iconExpand/collapse icon rotation or swap.
data-expanded="true|false"Item, IndicatorToggle child visibility and icon state.
data-selected="true|false"ItemSelection highlight.
data-disabled="true|false"ItemMuted/disabled presentation.

Primitive CSS starter

Headless tree CSS contract

css
/* Collapse children when parent is not expanded */
[data-slot='tree-item'][data-expanded='false'] > [data-slot='tree-group'] {
  display: none;
}

/* Selection highlight */
[data-slot='tree-item'][data-selected='true'] {
  background: color-mix(in srgb, var(--tng-semantic-accent-brand) 12%, transparent);
  color: var(--tng-semantic-accent-brand);
}

/* Focus ring */
[data-slot='tree-item']:focus-visible {
  box-shadow: 0 0 0 2px var(--tng-semantic-focus-ring);
}

/* Group indentation */
[data-slot='tree-group'] {
  margin-left: 1.25rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--tng-semantic-border-subtle);
}

Component CSS classes

ClassElementPurpose
.tng-tree-shellRoot wrapperBackground, border, border-radius, padding.
.tng-tree-rootFocusable containerGrid layout, outline, focus ring.
.tng-tree-itemRowGrid layout with --tng-tree-level indentation.
.tng-tree-item-activeActive rowKeyboard-focused highlight.
.tng-tree-item-selectedSelected rowSelection background.
.tng-tree-item-disabledDisabled rowReduced opacity, not-allowed cursor.
.tng-tree-toggleExpand/collapse buttonDisclosure toggle styling.
.tng-tree-nodeLabel buttonClickable label area for selection.
.tng-tree-labelLabel textPrimary node text.
.tng-tree-descriptionDescription textSecondary muted description.

Component CSS starter

Component tree CSS contract

css
.tng-tree-shell {
  background: var(--tng-semantic-background-base);
  border: 1px solid var(--tng-semantic-border-subtle);
  border-radius: 0.75rem;
  padding: 0.75rem;
}

.tng-tree-item {
  padding-inline-start: calc(0.5rem + (var(--tng-tree-level) * 1rem));
}

.tng-tree-item-active {
  background: color-mix(in srgb, var(--tng-semantic-focus-ring) 15%, transparent);
}

.tng-tree-item-selected {
  background: color-mix(in srgb, var(--tng-semantic-accent-brand) 18%, transparent);
}

.tng-tree-item-disabled {
  cursor: not-allowed;
  opacity: 0.55;
}