Skip to content
Stylhero 0.8.0
Components

Core

Layout and type

Inputs

Overlays

Navigation

Data display

Charts

Transitions and utilities

Page pieces (landing pages, portfolios, docs)

Icons

Components / Navigation

Pagination

Page numbers with previous and next buttons. The current page is marked with aria-current.

import { Pagination } from "@stylhero/ui";

Example

Code
import { useState } from "react";
import { Pagination } from "@stylhero/ui";

function PaginationExample() {
  const [page, setPage] = useState(3);
  return <Pagination page={page} count={12} onPageChange={setPage} />;
}

Props

PropTypeDefaultDescription
count required number - Total number of pages.
onPageChange required (page: number) => void -
page required number - Current page, starting at 1.
siblings number 1 Pages shown on each side of the current one.

Also takes the HTML attributes of its root element (id, style, data-*, aria-*, event handlers…).

Keyboard

KeyDoes
TabMoves between the page buttons
Enter / SpaceGoes to the page

Accessibility

  • A labelled <nav>; the current page has aria-current="page".

Generated from src/components/Pagination.tsx. Something wrong or missing? Open an issue.