Paginate is the Bitblue pagination control used under tables and datatables. Wire page state and handlers from the parent; keep interactive counters in example fences when needed.
Setup
<script lang="ts">
import { Paginate } from '.';
</script> Default
Page 2/8
(128) <script lang="ts">
import { Paginate } from '.';
let currentPage = $state(1);
const totalPages = 5;
</script>
<Paginate
{currentPage}
{totalPages}
recordCount={42}
hasPreviousPage={currentPage > 1}
hasNextPage={currentPage < totalPages}
onPreviousPage={() => currentPage--}
onNextPage={() => currentPage++}
hideLabel={false}
/> Compact (hide labels)
By default hideLabel is true (icon-only prev/next).
1/3
(0) <Paginate
currentPage={1}
totalPages={3}
hasPreviousPage={false}
hasNextPage={true}
onPreviousPage={() => {}}
onNextPage={() => {}}
/> Small text
Page 4/12
(240) Refresh control
Pass refresh to show a reload icon.
Page 1/4
(0) <script lang="ts">
import { Paginate } from '.';
</script>
<Paginate
currentPage={1}
totalPages={4}
hasPreviousPage={false}
hasNextPage={true}
onPreviousPage={() => {}}
onNextPage={() => {}}
refresh={() => console.log('reload')}
hideLabel={false}
/> Column visibility menu
When tableColumns is non-empty, a columns dropdown appears. Bind hiddenColumns to sync visibility with your table.
Page 1/2
(0) <script lang="ts">
import { Paginate } from '.';
let hiddenColumns = $state(['role']);
const tableColumns = [
{ header: 'Name', id: 'name' },
{ header: 'Email', id: 'email' },
{ header: 'Role', id: 'role' }
];
</script>
<Paginate
currentPage={1}
totalPages={2}
hasPreviousPage={false}
hasNextPage={true}
onPreviousPage={() => {}}
onNextPage={() => {}}
{tableColumns}
bind:hiddenColumns
hideLabel={false}
/> Props
| Prop | Type | Default | Description |
|---|---|---|---|
currentPage | number | — | Active page (required) |
totalPages | number | — | Total page count (required) |
hasNextPage | boolean | — | Enable next control (required) |
hasPreviousPage | boolean | — | Enable previous control (required) |
onNextPage | () => void | — | Next handler (required) |
onPreviousPage | () => void | — | Previous handler (required) |
refresh | (() => void) \| null | null | Optional reload callback / icon |
hideLabel | boolean | true | Hide “PREV” / “NEXT” / “Page” text |
textSmall | boolean | false | Smaller typography |
recordCount | number | 0 | Optional total records shown as (n) |
pageSize | number | — | Page size (typed for table integrations) |
tableColumns | any[] | [] | When set, shows column visibility menu |
hiddenColumns | string[] | [] | Bindable hidden column ids |