Navigation
Pagination
Page through a long list of records, such as claims or panel clinics, a screenful at a time.
Purpose
Pagination keeps a position addressable, which infinite scroll does not. Data grid wires this up for you.
Example
Structure
The parts reuse buttonVariants, so pagination inherits the button tokens.
| Property | Value |
|---|---|
| Layout | centred nav, items in a 4px-gap row |
| Page link | 32px square, ghost button style, 14px / Inter 600 |
| Active page | --primary fill with --primary-foreground number, aria-current="page" |
| Previous / Next | ghost button, 32px tall, 18px chevron glyph + text label |
| Ellipsis | 32px square, 18px more_horiz glyph in --muted-foreground |
| Focus | 2px --ring, offset 2px |
Best practices
Do
- Give every link a real
hrefso each page stays addressable and shareable. - Collapse long ranges with
PaginationEllipsis, keeping the first page, the last page and the current page's neighbours visible. - Mark the current page with
isActive— it sets both the filled style andaria-current. - Omit Previous or Next at the ends of the range — there is no disabled state to fall back on.
Don't
- Render Previous or Next as a dead link with no
href— omit it instead. - Use pagination for a feed that has no meaningful position — a "load more" button is honest there.
- Show pagination for a single page of results.
- Move the control between pages — keep it in the same place so paging is a repeatable click.
Accessibility & keyboard
- The root is a
navlandmark labelled "pagination". - The current page carries
aria-current="page". - Previous and next are plain links with no disabled state — omit them (or swap in a muted placeholder) at the first and last page rather than rendering a dead link.
- Previous and Next carry explicit labels ("Go to previous page" / "Go to next page"); their chevrons are decorative and hidden.
- The ellipsis is
aria-hidden— it is a visual gap, not a control. - Keyboard: Tab moves between links; Enter follows one.
Props
Every part is a styled native element — nav, ul, li, a, span — and accepts the matching
native attributes. The one addition is isActive on PaginationLink, which switches it to the
filled style and sets aria-current="page".