Skip to content

AnchorNav

The sections of a long page, with the one in view lit as the person scrolls.

import { AnchorNav } from '@sypnia/ui/react'

On this page
  1. The sections of this page
  2. When to use it
  3. For everyone
  4. Props

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

AnchorNavTypeDefault
itemsrequired { id: string; label: ReactNode; }[]
label string
  1. The sections of this page
  2. When to use it
  3. For everyone
  4. Props

    Search pages, sections and terms