Pagination
Pagination component with ellipses for long lists, rounded and simple variants, controlled by a page state.
How to use it
Run npx @blossomui/react add pagination, or copy src/components/UI/Pagination/Pagination.tsx into your React project and import it.
import { getPages, Pagination, SimplePagination } from './components/ui/Pagination'
Props
PaginationLabels
| Prop | Type | Description |
|---|
| navigation (required) | string | |
| previous (required) | string | |
| next (required) | string | |
| previousPage (required) | string | |
| nextPage (required) | string | |
| page (required) | (page: number) => string | Accessible name of the button of a page. |
| pageWord (required) | string | Word before the current page in the simple version. |
| of (required) | string | Word between the current page and the total in the simple version. |
PaginationProps
| Prop | Type | Description |
|---|
| labels | Partial<PaginationLabels> | Texts of the component. Pass only the ones you want to change, for example to translate it. |
| color | string | Accent color of this component: any CSS color. Without it the component uses `--blossom-accent`, which is pink by default. |
| page (required) | number | Current page, starting at 1. |
| total (required) | number | Total number of pages. |
| onChange (required) | (page: number) => void | |
| siblings | number | Pages shown on each side of the current one. |
| rounded | boolean | |
SimplePaginationProps
| Prop | Type | Description |
|---|
| labels | Partial<PaginationLabels> | Texts of the component. Pass only the ones you want to change, for example to translate it. |
| color | string | Accent color of this component: any CSS color. Without it the component uses `--blossom-accent`, which is pink by default. |
| page (required) | number | |
| total (required) | number | |
| onChange (required) | (page: number) => void | |