Preview rail
A rail of ticks that previews each section on hover and jumps to it.
Introduction
The Halden API creates invoices, matches payments and tells you when either changes. Every plan includes it; the Team plan allows 100 requests a second.
When to use
- Long pages and documents with named sections.
- Showing where you are and what comes next.
When not to use
- Short pages with no sections.
Installation
terminal
pnpm dlx shadcn@latest add @caliper/preview-rail
Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.
API reference
PreviewRail
7 props
PropTypeDefaultDescription
labelstring"Sections"
items *readonly PreviewRailItem[]—
valuestring—The section in view; its tick stays long.
onSelect((id: string) => void)—Called when a tick is chosen, to scroll to that section.
onActiveChange((id: string | null) => void)—Called with the tick being previewed, or null when none is.
side"left" | "right""left"Which side of the rail the preview opens on; "left" suits a rail at the right edge of a page.
classNamestring—
Keyboard
- Escape
- Closes or cancels, then returns focus to where it came from.
Accessibility
It is built on native elements and keeps aria-label, aria-current and aria-hidden in step with state.
Notes for AI
Give your coding assistant this page as Markdown instead of screenshots: the props, keyboard and examples in one file.
/docs/components/preview-rail.mdThe index of every part is at /llms.txt.