<tc-pagination>
Prev/next + windowed page numbers with ellipses. Emits a change event — the parent decides when to update.
Props
| Name | Type | Default | Description |
|---|---|---|---|
current | number | 1 | The active page (1-based). |
total | number | 1 | Total number of pages. When `total <= 1` the component renders nothing. |
siblings | number | 1 | How many page numbers to show on each side of the current page. |
boundaries | number | 1 | How many pages to always keep visible at the very start and end of the range. |
size | "sm" | "md" | "lg" | "sm" | Forwarded to the underlying `tc-button` controls. |
prev-label | string | "Prev" | Text on the "previous" button. Useful for i18n. |
next-label | string | "Next" | Text on the "next" button. |
label | string | "Pagination" | Accessible label on the wrapping `<nav>`. |
Events
| Event | Detail | When |
|---|---|---|
tc-page-change | { page: number } | Fires when the user picks a different page. The component does NOT update `current` itself — the parent must. |
Examples
Basic usage
The component is controlled — it tells you when the user clicks a page, and you decide what to do.
Windowing
siblings controls how many numbers appear on each side of the current page; boundaries keeps a fixed number of pages pinned to the ends. With current=5, total=10, siblings=1, boundaries=1 you get: 1 … 4 5 6 … 10.
Wider window:
Sizes
size is forwarded to the underlying tc-buttons.
Custom labels
Useful for translated UIs:
Small datasets
When total <= 1, the component renders nothing — safe to drop into a page that may or may not need paginating.
With tc-table
tc-table has its own built-in pagination, but for client-side filtering with custom page UI, render the table without its pager and use tc-pagination separately:
Theming
The component delegates all styling to tc-button and the global accent + ink tokens. To re-skin, theme tc-button.
Accessibility
- The container is a
<nav>with anaria-label(default: "Pagination"). - The current page button has
aria-current="page"and is non-interactive viapointer-events: none. - Prev / next buttons are disabled at the edges; disabled buttons drop their
data-pageso clicks do nothing. - The ellipsis is
aria-hidden— screen readers skip the visual separator and announce only the page numbers.