Pagination
Pagination moves through a list or table. The active page is a solid brand fill with brand-on text, the same language as a primary Button. In Chinese this component is 分頁器, so it does not share the Tabs name 分頁.
Demos
Basic
Inactive pages are transparent and pick up an 18% brand wash on hover. The current page uses
aria-current="page". Many pages
Ellipsis keeps the first page, the last page, and the pages around the current one. The total reads from
item-count. The size picker and quick jumper match the control height. Sizes
sm / md / lg are 28 / 34 / 40, the same scale as Button. Disabled
disabled mutes the bar and sets aria-disabled. End buttons are also disabled when there is no previous or next page. Controlled
update:page and change carry { page }. update:page-size carries { pageSize } and the page resets to 1. Arrow keys move the page when focus is on a page button. Page 5, 10 / page
API
Pagination Props
| Prop | Type | Default |
|---|---|---|
page | number | 1 |
page-size | number | 10 |
item-count | number | — |
page-count | number | — |
page-sizes | number[] | [10, 20, 30, 50] |
show-size-picker | boolean | false |
show-quick-jumper | boolean | false |
show-total | boolean | false |
size | 'sm' | 'md' | 'lg' | 'md' |
disabled | boolean | false |
page-slot | number | 7 |
When item-count is set, the page count is ceil(item-count / page-size). Otherwise page-count is used. page is clamped to 1…pageCount. page-sizes accepts a comma list or a JSON array.
Pagination Events
| Event | Detail |
|---|---|
update:page | { page: number } |
change | { page: number } |
update:page-size | { pageSize: number } |
Changing the page size resets the page to 1 and emits update:page when the page actually changes.
CSS Parts
| Part | Description |
|---|---|
root | nav landmark |
nav | Page button group |
item / item-active | Numbered page |
prev / next | Chevron buttons |
ellipsis | Static … |
size-picker | Page-size select |
quick-jumper | Go-to field |
total | Total text |
Accessibility
- The landmark label follows the document language: “Pagination” or 「分頁器」. Set
aria-labelon the host to override it. - The active page has
aria-current="page". - Previous / next are labeled. Disabled controls set
aria-disabled="true". - The quick jumper input has its own label.