AnchorNav
The sections of a long page, with the one in view lit as the person scrolls.
import { AnchorNav } from '@sypnia/ui/react'
The sections of this page
Scroll the page: the light follows.
Code
import { AnchorNav } from '@sypnia/ui/react';
// The sections of this page: the one in view is lit as you scroll.
export default function Sections() {
return <AnchorNav items={[{ id: 'rules', label: 'When to use it' }, { id: 'accessibility', label: 'For everyone' }, { id: 'props', label: 'Props' }]} />;
} When to use it
Use it when
- Long pages with several headings, beside the content.
Do not use it when
- Pages with two sections.
For everyone
- It is a navigation named «On this page»; the current section is
aria-current="location".
Props
| AnchorNav | Type | Default |
|---|---|---|
itemsrequired | { id: string; label: ReactNode; }[] | |
label | string |