Internal ID software / Navigation
Pagination
Moving through a long list, as a list of links.
Not drawn in Figma: built only from the tokens, for internal ID software. In code: components/software/pagination.tsx. From the old system: Pagination in @id-identity-as/ui/commerce.
Example
import { Pagination } from '@/components/software/pagination';
<Pagination page={3} pageCount={12} href={(page) => `/ordrer?side=${page}`} />Props
| Prop | Type | Default | What it does |
|---|---|---|---|
page (required) | number | The page shown now, from 1. | |
pageCount (required) | number | How many pages there are. With one page nothing is rendered. | |
href (required) | (page: number) => string | The address of a page. Every page is a real link. | |
labels | Partial<PaginationLabels> | { nav, previous, next, page }. Danish by default. Pass translations here. | |
as | ElementType | 'a' | The element to render a link with, such as the link of the framework. |
Do
- Keep the page in the address, so back, bookmarks and shared links work.
- Say above the list what is shown: "Viser 49 til 72 af 270".
Do not
- Do not build it from buttons with state. A page is a place, so it is a link.
- Do not replace it with an endless "Vis flere". Everything past the first page is then out of reach.
Accessibility
- A named navigation. The current page has aria-current and is not a link.
- At the first and the last page the edge is plain text, not a disabled button.
Tokens it uses
- color.text.default
- color.software.muted
- radius.sm
- type.body.md
- type.heading.md
- space.inline.1
- space.inline.2
- space.section.1