Pagination

A navigation component for paginating through large datasets with customizable page controls.

Anatomy

<script>
  import { Pagination } from "@saas-ui/svelte/components/pagination";
</script>

<Pagination
  count={100}
  pageSize={10}
  defaultPage={1}
/>

Examples

Attached Accessibility

Pagination with visually attached buttons using the attached prop.

Basic Accessibility

Basic pagination with default styling and page numbers.

Colours Accessibility

Pagination with different colour schemes using the colour prop.

Compact Accessibility

Compact pagination showing page text only instead of individual page buttons.

Controlled Accessibility

Controlled pagination with external state management using the page prop.

Count Text Accessibility

Pagination with long count text format showing item range and total.

Data Driven Accessibility

Pagination integrated with data-driven content to display paginated items.

Sibling Count Accessibility

Pagination with more sibling pages visible using the siblingCount prop.

Sizes Accessibility

Pagination in different sizes. Available sizes: xs, sm, md, lg.

Variants Accessibility

Pagination with different variants. Available variants: ghost, outline, solid.

Props

Pagination

A navigation component for paginating through data.

Prop Type Default Description
count number - Total number of data items.
pageSize number 10 Number of data items per page.
page number - The controlled active page.
defaultPage number 1 The initial active page when uncontrolled.
siblingCount number 1 Number of pages to show beside active page.
size "xs" | "sm" | "md" | "lg" "md" The size of the pagination items.
variant "ghost" | "outline" | "solid" "ghost" The visual style variant of the pagination.
colour ColourName "gray" The colour theme of the pagination.
compact boolean false Whether to show compact page text instead of page items.
pageTextFormat "short" | "long" "short" The format of the page text when compact is true. "short" shows "1 of 7", "long" shows "1 - 5 of 50".
attached boolean false Whether items should be visually attached.
type "button" | "link" "button" The type of the trigger element.
getHref (page: number) => string - Function to generate href attributes for pagination links. Only used when type is 'link'.
onPageChange (details: { page: number }) => void - Called when the page number changes.
class string - Additional CSS classes to apply.
style string - Inline styles.
id string - The id of the pagination element.
aria-label string "pagination" Accessible label for the pagination navigation. Required when multiple paginations exist on a page.