Markdown:
Components

Pagination

A page navigator that coordinates first, previous, next, last, and page input controls.

Page 4 of 12

Usage

Use as a coordinator around ComboBox.

Svelte
<Pagination comboBox={{ placeholder: "Page" }} />

<Pagination>
  <ComboBox />
</Pagination>

Anatomy

The class attribute values represent part names. Other attributes represent their corresponding props. An embedded ComboBox renders between the left and right buttons unless children is supplied.

Svelte
<nav class="whole" aria-label>
  <button class="top" type="button" aria-label aria-disabled>{top}</button>
  <button class="left" type="button" aria-label aria-disabled>{left}</button>
  {#if children}{children}{:else}<ComboBox />{/if}
  <button class="right" type="button" aria-label aria-disabled>{right}</button>
  <button class="bottom" type="button" aria-label aria-disabled>{bottom}</button>
</nav>
  • The page commits on ComboBox blur, Enter, and option select; invalid input reverts and out-of-range input clamps.
  • Buttons use aria-disabled, stay focusable at bounds, and suppress their action while at-bound.
  • Part names map by position: TOP=first, LEFT=prev, RIGHT=next, BOTTOM=last.
  • Embedded ComboBox is wired through context; comboBox is ignored when children is supplied.
  • onchange fires a native change Event after user-initiated page changes (nav buttons or ComboBox commits); read the new page from bound value. Programmatic value changes and bound clamping do not fire it.
  • The default shortcut list is centered on the current page. A caller-provided options list can follow the page with bind:value={page} and const opts = $derived(...); no change event is needed.

Props

NameTypeDefaultDescription
childrenSnippet-Custom pagination content; receives value and variant
valuenumber1Bindable current page
minnumber1First page
maxnumber-Last page; defaults to max(min, value)
optionsnumber[]-Shortcut page numbers shown by the embedded ComboBox
topSnippet-FIRST button content; receives value and variant
leftSnippet-PREV button content; receives value and variant
rightSnippet-NEXT button content; receives value and variant
bottomSnippet-LAST button content; receives value and variant
ariaLabelstring"Pagination"Accessible label for the nav landmark
buttonLabelsPaginationLabel-Accessible labels for the buttons; defaults First/Previous/Next/Last page
comboBoxComboBoxProps-Config bag spread into the embedded ComboBox; uses the flat inner-prop shape and is ignored when children is supplied
stylingSVSClass-Styling override
variantSVSVariantNEUTRALVariant

Other <nav> attributes are passed to <nav> via rest props; class is merged onto the root.

Styling

To learn more, see Styling.

Variant Management

The FIRST and PREV buttons render with VARIANT.INACTIVE while value is at min; NEXT and LAST render with VARIANT.INACTIVE while value is at max.

Default Class Name

svs-pagination

Behavior

  • The page commits on ComboBox blur, Enter, and option select; invalid input reverts and out-of-range input clamps.
  • Buttons use aria-disabled, stay focusable at bounds, and suppress their action while at-bound.
  • Part names map by position: TOP=first, LEFT=prev, RIGHT=next, BOTTOM=last.
  • Embedded ComboBox is wired through context; comboBox is ignored when children is supplied.
  • onchange fires a native change Event after user-initiated page changes (nav buttons or ComboBox commits); read the new page from bound value. Programmatic value changes and bound clamping do not fire it.
  • The default shortcut list is centered on the current page. A caller-provided options list can follow the page with bind:value={page} and const opts = $derived(...); no change event is needed.

Accessibility

ARIA Roles and Attributes

The component applies these automatically:

  • Navigation (whole <nav>): aria-label, defaulting to "Pagination" and overridable with ariaLabel.
  • Boundary buttons (top, left, right, bottom <button>): aria-label from buttonLabels.top, buttonLabels.left, buttonLabels.right, or buttonLabels.bottom, and aria-disabled while the button is at its first-page or last-page boundary.
  • Button icons (<svg>): aria-hidden="true" and focusable="false".

The boundary buttons stay focusable at their bounds and suppress their action instead of leaving the tab order. When the jump control is rendered by the default ComboBox, see ComboBox for its ARIA attributes and keyboard behavior.

Standards Basis

Pagination's boundary controls are native <button> elements, so keyboard and assistive-technology support follows the browser standard for button controls. See the Concepts standards-first guidance for the library's approach.

Exports

Types

TypeScript
type PaginationLabel = { top?: string; left?: string; right?: string; bottom?: string };
interface PaginationProps extends Omit<HTMLAttributes<HTMLElement>, "children" | "aria-label"> {
  children?: Snippet<[number, string]>; // Snippet<[value,variant]>
  value?: number; // bindable; current page (default 1)
  min?: number; // first page (default 1)
  max?: number; // last page (default = max(min, value))
  options?: number[]; // shortcut list shown in the ComboBox
  top?: Snippet<[number, string]>; // Snippet<[value,variant]>; FIRST button content
  left?: Snippet<[number, string]>; // Snippet<[value,variant]>; PREV button content
  right?: Snippet<[number, string]>; // Snippet<[value,variant]>; NEXT button content
  bottom?: Snippet<[number, string]>; // Snippet<[value,variant]>; LAST button content
  ariaLabel?: string; // ("Pagination")
  buttonLabels?: PaginationLabel; // ({top:"First page",left:"Previous page",right:"Next page",bottom:"Last page"})
  comboBox?: Omit<ComboBoxProps, ComboBoxReqdProps | ComboBoxBindProps | "options" | "variant" | "styling">;
  styling?: SVSClass;
  variant?: SVSVariant; // (VARIANT.NEUTRAL)
  // other nav attributes are passed to <nav> via ...rest; `class` is merged onto root
}
type PaginationReqdProps = never;
type PaginationBindProps = "value";

Others

No additional exports are available.

Examples

The example code uses Tailwind CSS along with SVSClass.

Basic

Page 4 of 12

With Interactive Variant

Preset for Demo
Enter variant as you like
Page 5 of 9