Pagination
Moves through pages of results with previous, next and numbered controls.
Selector: mui-pagination
import { Pagination } from '@mushilu-san/ui/navigation';Loading example…
Overview
role="navigation" with previous and next buttons and page buttons. The current page is a two-way page model, and totalPages sets the range.
siblingCount sets how many pages show on each side of it.
When to use
Lists of results split across pages, such as search results or a table of records. Any list where the user needs to jump to a page by number.
When not to use
A short list that fits on one screen. An endless feed. Use a "Load more" button. Use Button instead.
Guidelines
Do
Show the total result count near the list so users know how many pages there are. Keep the page the user is on in the URL when the list is shareable.
Don't
Do not hide pagination when there is only one page. Disable the controls instead.
Accessibility
Roles and attributes
| Element | Role | Notes |
|---|---|---|
host | navigation | aria-label from ariaLabel, default "Pagination". |
previous / next | button | aria-disabled at the ends. |
page | button | aria-current="page" on the current page. |
Keyboard
| Keys | Action |
|---|---|
| TabShiftTab | |
| EnterSpace |
Ellipses are decorative and hidden from assistive technology.
API
Pagination
| Name | Type | Default | Description |
|---|---|---|---|
totalPages | number | — | Total number of pages. |
siblingCount | number | 1 | Number of page buttons shown on each side of the current page. Default `1`. |
showFirstLast | boolean | true | Shows the first and last page buttons next to the ellipses. Default `true`. Accepts attribute presence, e.g. <… showFirstLast>. |
size | 'sm' | 'md' | 'lg' | 'md' | Button size: `sm`, `md` or `lg`. Default `md`. |
variant | 'default' | 'outline' | 'default' | Visual style: `default` or `outline`. Default `default`. |
ariaLabel | string | 'Pagination' | Accessible name of the navigation landmark. Default `Pagination`. |
| Name | Type | Default | Description |
|---|---|---|---|
page | number | 1 | Current page, starting at 1. Two-way bindable with `[(page)]`. |
CSS parts
::part(ellipsis)::part(item)::part(next)::part(page)::part(pagination)::part(prev)
Tokens
--mui-color-primary--mui-color-primary-text--mui-color-border--mui-color-focus-ring--mui-touch-target