Skip to main content

Starwind UI v3.0 is now available! Migration guide

Pagination

Installation

Usage

General Notes

The basic pagination component includes previous/next buttons and numbered pages.

Tip

Use the isActive prop on <PaginationLink> to highlight the current page.

Sizes

Set size="sm", size="md" (the default), or size="lg" once on Pagination. The root publishes the resolved size through data-size, and every link, navigation control, and ellipsis uses that shared visual scale.

Size migration

BeforeAfter
<PaginationLink size="icon-sm" /><Pagination size="sm"><PaginationLink /></Pagination>
<PaginationPrevious size="lg" /><Pagination size="lg"><PaginationPrevious /></Pagination>

API Reference

Styled Component API

These props are added or materially changed by the installed styled component. Standard HTML attributes remain available through the inherited interfaces noted below. Expand a prop to see named type definitions and framework-specific imports. Follow the Primitive and Runtime links for lower-level behavior props.

Pagination

Inherits nav attributes.

Contains the following additional props:

Prop Type Default Toggle details
size "sm" | "md" | "lg" "md"
Description
Selects the component's visual size.
Classification
Wrapper prop

Inherits Button props. Omits `as`, `ref`, and `variant`.

Contains the following additional props:

Prop Type Default Toggle details
isActive boolean
Description
Applies the active visual state.
Classification
Wrapper prop

Changelog

v4.0.1

  • Named the generated aggregate default export so React and Astro tooling can identify the installed component cleanly.

v4.0.0

  • Moved size ownership to Pagination; remove size from PaginationLink, PaginationPrevious, PaginationNext, and PaginationEllipsis.
  • Migration: <PaginationLink size="icon-sm" /> becomes <Pagination size="sm"><PaginationLink /></Pagination>.

v3.1.0

  • Added contract-generated Astro and React implementations while preserving the component’s existing public API and styling.

v3.0.4

  • Refactor tailwind variants functions into separate variants.ts file

v3.0.2

  • add size prop to PaginationEllipsis
  • Adjust PaginationNext and PaginationPrevious to use button variant props for sizes

v3.0.1

  • Add named slot “icon” to PaginationEllipsis to enable easy icon swapping, and a default slot for the sr-only label
  • Add named slot “icon” to PaginationNext and Pagination Previous to enable easy icon swapping

v3.0.0

  • Now requires the starwind button component installed to make use of the button variants for PaginationLink

v2.1.0

  • Add data-slot attribute to enable global styling updates

v2.0.1

  • Add eslint comments to disable “no-explicit-any” when using Astro special syntax to require a child element

v2.0.0

  • tailwind-variants now implemented. This uses tailwind-merge under the hood to merge Tailwind classes without style conflicts.
  • Removed radius prop now that classes like “rounded-full” can be passed to the components to override, taking advantage of tailwind-variants