Home

Navigation Tree

Usage

The navigation tree is the collapsible hierarchy used in the left sidebar. Start with:

  • --nav-tree-item-* for typography, padding, and color

  • --nav-tree-indent to control nesting depth

  • --nav-tree-item-bg-* for hover and active backgrounds

  • --nav-tree-transition-duration for interaction timing

  • --nav-tree-focus-ring-* tokens for keyboard focus styling

Tokens

Typography Tokens

TokenDescriptionDefault Value
--nav-tree-font-familyFont family for navigationvar(--layout-font-family)
--nav-tree-title-font-sizeTitle font sizevar(--font-size-xs)
--nav-tree-title-font-weightTitle font weightvar(--font-weight-semibold)
--nav-tree-title-colorTitle text colorvar(--text-color-secondary)
--nav-tree-title-margin-bottomSpace below titlevar(--space-3)
--nav-tree-item-font-sizeItem font sizevar(--font-size-sm)
--nav-tree-item-line-heightItem line heightvar(--line-height-snug)
--nav-tree-item-padding-yItem vertical paddingvar(--space-1)
--nav-tree-item-padding-xItem horizontal paddingvar(--space-2)

Color Tokens

TokenDescriptionDefault Value
--nav-tree-item-colorDefault item text colorvar(--text-color-secondary)
--nav-tree-item-color-hoverHover item text colorvar(--text-color-primary)
--nav-tree-item-color-activeActive item text colorvar(--color-accent)
--nav-tree-item-bg-hoverHover item backgroundvar(--surface-sunken)
--nav-tree-item-bg-activeActive item backgroundcolor-mix(in srgb, var(--color-accent) 10%, transparent)

Structure Tokens

TokenDescriptionDefault Value
--nav-tree-indentIndent per levelvar(--space-4)
--nav-tree-toggle-sizeToggle icon font sizevar(--font-size-xs)
--nav-tree-chevron-sizeChevron size0.5em

Interaction Tokens

TokenDescriptionDefault Value
--nav-tree-transition-durationInteraction transitionvar(--transition-duration-fast)
--nav-tree-focus-ring-widthFocus ring widthvar(--focus-ring-width)
--nav-tree-focus-ring-colorFocus ring colorvar(--focus-ring-color)
--nav-tree-focus-ring-offsetFocus ring offsetvar(--focus-ring-offset)
--nav-tree-focus-radiusFocus ring radiusvar(--radius-xs)

Examples

Compact Tree

Tighter spacing for dense navigation:

:root {
  --nav-tree-item-font-size: var(--font-size-xs);
  --nav-tree-item-padding-y: 2px;
  --nav-tree-indent: var(--space-3);
}

High-Contrast Active State

Emphasize the current page:

:root {
  --nav-tree-item-color-active: var(--text-color-primary);
  --nav-tree-item-bg-active: var(--surface-elevated);
  --nav-tree-item-color-hover: var(--text-color-primary);
}

Tips

Indent control: --nav-tree-indent affects all levels; reduce it for shorter sidebars.

Hover feedback: Combine --nav-tree-item-bg-hover with --nav-tree-item-color-hover for clear interaction states.

Active emphasis: Pair --nav-tree-item-color-active with --nav-tree-item-bg-active for strong current-page contrast.

© 2026 Stencila