Scroll Nav
Sticky sidebar that highlights the section in view as you scroll.
Import
import { ScrollNav } from "@cronus-ui/ui";
npx cronus-ui add scroll-nav
Examples
.cronus
The same component declared in Cronus. Emitted at build time from the audit fixtures — the kernel renders it as HTML with no React.
default.cronus
app "audit-fixtures" {
port 5176
}
style {
preset aurora
theme dark
}
component ScrollNavDefault layout:inline style:scroll-nav {
label "Terms & Conditions"
text "Acceptance" -> "#acceptance"
text "By using the service you agree to these terms."
text "Privacy" -> "#privacy"
text "We store only what the product needs."
}
page "/audit/scroll-nav/default" type:custom {
use ScrollNavDefault
}
API Reference
Generated from the component's exported types.
ScrollNavLabels
| Prop | Type | Default | Description |
|---|---|---|---|
nav* | string | — | Accessible name for the sticky section list. |
ScrollNavProps
Extends Omit< ComponentPropsWithoutRef<"div">, "title" | "onAnimationStart" | "onAnimationEnd" | "onDrag" | "onDragStart" | "onDragEnd" >
| Prop | Type | Default | Description |
|---|---|---|---|
ref | Ref<HTMLDivElement> | — | Ref forwarded to the underlying DOM node. |
title | string | "Terms & Conditions" | Page heading. |
terms* | ScrollNavTerm[] | — | — |
viewportRef | RefObject<HTMLElement | null> | — | Scroll container. When set, the spy observes this box instead of the viewport — needed when the nav lives inside a nested scroller (docs preview). |
labels | Partial<ScrollNavLabels> | — | Override default English strings. |
className | string | — | Additional class names merged onto the root. |
children | ReactNode | — | Contents of the component. |
id | string | — | DOM id of the root element. |