Skip to content
Components

Table of contents

Sticky in-page navigation with scroll-spy range highlighting.

Composition

Section navigation

Pass items with IDs matching the headings in the document; the component renders the navigation.

  • <TableOfContents />

Installation

The Control UI source installs this primitive from src/registry/sources/control-ui/ui/table-of-contents.tsx.

Registry command
See registry manifest

Raw code

Primary installed source

src/registry/sources/control-ui/ui/table-of-contents.tsx

Knobs

Typed custom properties the recipe paints with. Set one on the root — style, a utility class, or a skin — and every slot inherits it.

--cui-table-of-contents-* · 27 knobsHow the cascade resolves
--cui-table-of-contents-background<color>var(--card)
--cui-table-of-contents-border-color<color>var(--border)
--cui-table-of-contents-border-width<length>var(--control-rim-width)
--cui-table-of-contents-radius<length-percentage>var(--radius-panel)
--cui-table-of-contents-shadow*var(--shadow-sm)
--cui-table-of-contents-backdrop-filter*none
--cui-table-of-contents-padding<length-percentage>calc(var(--spacing) * 4)
--cui-table-of-contents-label-foreground<color>var(--muted-foreground)
--cui-table-of-contents-label-font-size<length-percentage>var(--text-caption)
--cui-table-of-contents-label-font-weight<number>var(--font-weight-medium)
--cui-table-of-contents-label-gap<length-percentage>calc(var(--spacing) * 3)
--cui-table-of-contents-item-foreground<color>var(--muted-foreground)
--cui-table-of-contents-item-hover-foreground<color>var(--foreground)
--cui-table-of-contents-item-active-foreground<color>var(--primary-text)
--cui-table-of-contents-item-font-size<length-percentage>var(--text-body)
--cui-table-of-contents-item-line-height<number>var(--leading-normal)
--cui-table-of-contents-item-font-weight<number>var(--font-weight-normal)
--cui-table-of-contents-item-root-font-weight<number>var(--font-weight-medium)
--cui-table-of-contents-item-padding-block<length-percentage>calc(var(--spacing) * 1.5)
--cui-table-of-contents-item-padding-inline<length-percentage>calc(var(--spacing) * 3)
--cui-table-of-contents-item-indent-size<length-percentage>calc(var(--spacing) * 2)
--cui-table-of-contents-rail-stroke<color>var(--border)
--cui-table-of-contents-rail-size<length-percentage>1px
--cui-table-of-contents-trail-stroke<color>var(--primary-text)
--cui-table-of-contents-trail-size<length-percentage>2px
--cui-table-of-contents-indicator-foreground<color>var(--cui-table-of-contents-trail-stroke)
--cui-table-of-contents-scroll-inset<length-percentage>calc(var(--spacing) * 20)