Skip to main content

Starwind UI v3.0 beta is now available! Check out the new docs and try it out!

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

Show pagination examples using small and large button sizes.

API Reference

Pagination

Wrapper for the default pagination component.

PropTypeDefault
classstring-
<Pagination>
<!-- Pagination content -->
</Pagination>

PaginationContent

Wrapper for the default pagination content component.

PropTypeDefault
classstring-
<PaginationContent>
<!-- Pagination items -->
</PaginationContent>

PaginationItem

Wrapper for the default pagination item component.

PropTypeDefault
classstring-
<PaginationItem>
<PaginationLink href="#">1</PaginationLink>
</PaginationItem>

A link component for page numbers with active state support. This uses default starwind button styles and similar props.

PropTypeDefault
isActivebooleanfalse
size"sm" | "md" | "lg" | "icon" | "icon-sm" | "icon-lg""icon"
hrefstring-
classstring-
<PaginationLink href="#" isActive>2</PaginationLink>

Additional Notes:

  • isActive: Highlights the current page

PaginationNext

A specialized wrapper of <PaginationLink> for the “Next” button that includes a right chevron icon.

PropTypeDefault
size"sm" | "md" | "lg" | "icon" | "icon-sm" | "icon-lg""md"
hrefstring-
classstring-
<PaginationNext href="#">Next</PaginationNext>

PaginationPrevious

A specialized wrapper of <PaginationLink> for the “Previous” button that includes a left chevron icon.

PropTypeDefault
size"sm" | "md" | "lg" | "icon" | "icon-sm" | "icon-lg""md"
hrefstring-
classstring-
<PaginationPrevious href="#">Prev</PaginationPrevious>

PaginationEllipsis

Includes a three-dot icon to indicate skipped pages.

PropTypeDefault
size"icon-sm" | "icon" | "icon-lg""icon"
classstring-
<PaginationEllipsis />

Changelog

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