|
| 1 | +--- |
| 2 | +layout: docs |
| 3 | +title: Pagination |
| 4 | +description: Documentation and examples for showing pagination to indicate a series of related content exists across multiple pages. |
| 5 | +group: Components |
| 6 | +--- |
| 7 | + |
| 8 | +import { Pagination } from 'boot-cell/source/Navigator/Pagination'; |
| 9 | + |
| 10 | +import { Example } from '../../../source/component/Example'; |
| 11 | + |
| 12 | +## Overview |
| 13 | + |
| 14 | +We use a large block of connected links for our pagination, making links hard to miss and easily scalable — |
| 15 | +all while providing large hit areas. |
| 16 | +Pagination is built with list HTML elements so screen readers can announce the number of available links. |
| 17 | +Use a wrapping `<nav>` element to identify it as a navigation section to screen readers and other assistive technologies. |
| 18 | + |
| 19 | +In addition, as pages likely have more than one such navigation section, |
| 20 | +it’s advisable to provide a descriptive `aria-label` for the `<Pagination />` to reflect its purpose. |
| 21 | +For example, if the pagination component is used to navigate between a set of search results, |
| 22 | +an appropriate label could be `aria-label="Search results pages"`. |
| 23 | + |
| 24 | +<Example> |
| 25 | + <Pagination total={3} current={2} aria-label="Page navigation example" /> |
| 26 | +</Example> |
| 27 | + |
| 28 | +```TSX |
| 29 | +import { render, createCell } from 'web-cell'; |
| 30 | +import { Pagination } from 'boot-cell/source/Navigator/Pagination'; |
| 31 | + |
| 32 | +render( |
| 33 | + <Pagination total={3} current={2} aria-label="Page navigation example" /> |
| 34 | +); |
| 35 | +``` |
| 36 | + |
| 37 | +## Sizing |
| 38 | + |
| 39 | +Fancy larger or smaller pagination? Add `size="lg"` or `size="sm"` for additional sizes. |
| 40 | + |
| 41 | +<Example> |
| 42 | + <Pagination size="lg" total={3} current={1} aria-label="..." /> |
| 43 | +</Example> |
| 44 | + |
| 45 | +```TSX |
| 46 | +import { render, createCell } from 'web-cell'; |
| 47 | +import { Pagination } from 'boot-cell/source/Navigator/Pagination'; |
| 48 | + |
| 49 | +render( |
| 50 | + <Pagination size="lg" total={3} current={1} aria-label="..." /> |
| 51 | +); |
| 52 | +``` |
| 53 | + |
| 54 | +<Example> |
| 55 | + <Pagination size="sm" total={3} current={1} aria-label="..." /> |
| 56 | +</Example> |
| 57 | + |
| 58 | +```TSX |
| 59 | +import { render, createCell } from 'web-cell'; |
| 60 | +import { Pagination } from 'boot-cell/source/Navigator/Pagination'; |
| 61 | + |
| 62 | +render( |
| 63 | + <Pagination size="sm" total={3} current={1} aria-label="..." /> |
| 64 | +); |
| 65 | +``` |
0 commit comments