Pager
Server-safe links to the previous and next page of a guide or docs site, each with the page's title. Works without JS; on the first or last page the missing side stays empty.
import { Pager } from "@/components/ui/pager";export function DocsPager() { return ( <Pager label="More guides" previous={{ title: "Install", href: "/docs/install" }} next={{ title: "Theming", href: "/docs/theming" }} /> );}<Pager>
Links to the previous and next page of a guide or docs site, titled so readers know where they lead. Layout follows its container.
labelDefault"Pages"stringAccessible name of the navigation.nextPagerLinkThe page after this one. Left out on the last page.nextLabelDefault"Next"ReactNodeWord over the next page's title.onNavigate(href: string, event: MouseEvent<HTMLAnchorElement, MouseEvent>) => voidonClickfor both links, e.g. for client routing or to stub links in a demo.previousPagerLinkThe page before this one. Left out on the first page.previousLabelDefault"Previous"ReactNodeWord over the previous page's title.
| Prop | Type | Default |
|---|---|---|
labelAccessible name of the navigation. | string | "Pages" |
nextThe page after this one. Left out on the last page. | PagerLink | — |
nextLabelWord over the next page's title. | ReactNode | "Next" |
onNavigateonClick for both links, e.g. for client routing or to stub links in a demo. | (href: string, event: MouseEvent<HTMLAnchorElement, MouseEvent>) => void | — |
previousThe page before this one. Left out on the first page. | PagerLink | — |
previousLabelWord over the previous page's title. | ReactNode | "Previous" |
Also accepts every <nav> prop.
- type PagerLink
- { title: ReactNode; href: string; }
Every component also takes className.