Pagination
The Pagination component pages through a list of items. It is built on Ark UI pagination, sourced from Shark UI, sharing the part classes from @cloudvoyant/helical-ui. Use the framework selector in the top-right to switch between implementations.
// apps/docs/src/components/examples/pagination/default/react.tsx
import { Pagination, PaginationItems, PaginationPrevious, PaginationNext } from '@cloudvoyant/helical-react';
export default function ReactPaginationDefault() {
return (
<Pagination count={50}>
<PaginationPrevious />
<PaginationItems />
<PaginationNext />
</Pagination>
);
}<!-- apps/docs/src/components/examples/pagination/default/svelte.svelte -->
<script lang="ts">
import { Pagination, PaginationItems, PaginationPrevious, PaginationNext } from '@cloudvoyant/helical-svelte';
</script>
<Pagination count={50}>
<PaginationPrevious />
<PaginationItems />
<PaginationNext />
</Pagination>Examples
Controlled
Page 2 of 12
Page 2 of 12
// apps/docs/src/components/examples/pagination/controlled/react.tsx
import { useState } from 'react';
import { Pagination, VStack, PaginationItems, PaginationPrevious, PaginationNext } from '@cloudvoyant/helical-react';
export default function ReactPaginationControlled() {
const [page, setPage] = useState(2);
return (
<VStack className="items-center gap-2">
<Pagination count={120} page={page} onPageChange={({ page }) => setPage(page)}>
<PaginationPrevious />
<PaginationItems />
<PaginationNext />
</Pagination>
<p className="text-sm text-muted-foreground">Page {page} of 12</p>
</VStack>
);
}<!-- apps/docs/src/components/examples/pagination/controlled/svelte.svelte -->
<script lang="ts">
import { Pagination, VStack, PaginationItems, PaginationPrevious, PaginationNext } from '@cloudvoyant/helical-svelte';
let page = $state(2);
</script>
<VStack class="items-center gap-2">
<Pagination count={120} {page} onPageChange={(details) => (page = details.page)}>
<PaginationPrevious />
<PaginationItems />
<PaginationNext />
</Pagination>
<p class="text-sm text-muted-foreground">Page {page} of 12</p>
</VStack>API Reference
Pagination
Props
Accepts all Ark PaginationRoot props plus className/class:
| Prop | Type | Default | Description |
|---|---|---|---|
count |
number |
— | Total number of items. |
page |
number |
— | Controlled current page. |
defaultPage |
number |
1 |
Initial page when uncontrolled. |
onPageChange |
(details) => void |
— | Fires when the page changes. |
pageSize |
number |
— | Items per page. |
defaultPageSize |
number |
10 |
Initial page size when uncontrolled. |
siblingCount |
number |
1 |
Page items shown around the current page. |
PaginationItems
Renders the page items plus ellipsis placeholders from the current page/sibling count. Takes no props.
PaginationItem
Props
| Prop | Type | Default | Description |
|---|---|---|---|
type |
'page' |
'page' |
Item type. |
value |
number |
— | The page number. |
Accepts all Ark PaginationItem props. The current page is marked with data-selected.
PaginationPrevious / PaginationNext
Self-contained prev/next buttons wrapping Ark’s prev/next triggers. Accept standard button attributes plus className/class.
PaginationEllipsis
The ellipsis placeholder between page items. Accepts standard element attributes plus className/class.
Accessibility
Follows the Pagination WAI-ARIA pattern. Ark exposes the prev/next triggers as buttons with aria-label and marks the current page item; data-selected drives styling.
Theming
No theme extension is required — the item/trigger states use existing tokens (bg-accent, text-muted-foreground, border-border, --radius-*), light and dark.