Skip to content
Klarhimmel UI

Pagination

npx shadcn add @klarhimmel/pagination

Examples

  • Buttons

  • Links

  • Edges

DetailsAbout, usage, props and more

Page navigation with Previous, Next and numbered pages, as buttons or as plain links.

When to use

  • Use for

    A list split over pages, with the current page and a way to move.

  • Not for

    Endless feeds, or fewer than two pages (render nothing).

  • Pairs with

    Table, lists, Cards.

Preview

Showing bookings 81 to 100

pagination.tsx
import { Theme } from '@/components/klarhimmel/theme/style';
import { Pagination } from '@/components/klarhimmel/ui/pagination';

export default function Example() {
  return (
    <Theme theme="brand">
      // links work without script: each page is its own address
      <Pagination page={3} pageCount={12} href={(n) => `/rooms?page=${n}`} />
    </Theme>
  );
}

Import

Import

import { Pagination, pageRange } from '@/components/klarhimmel/ui/pagination';
Files
pagination.tsx, in components/klarhimmel/ui/. With it: button, theme, utils. npm: lucide-react.
Render in
Render it inside <Theme>, once near the root of your app. Tokens and fonts are scoped to it, so outside it the component is unstyled.

Props

PropTypeDefaultDescription
pagenumberrequiredRounded down and clamped to the available pages; non-finite values use page 1.
pageCountnumberrequiredRounded down with a minimum of 1; non-finite values use 1.
onPageChange(page: number) => void-Buttons mode: called with the new page.
href(page: number) => string-Links mode: the URL of a page. Use this when each page is its own address (it works without script).
siblingsnumber1Whole, non-negative adjacent pages; non-finite values use the default of 1.
labelstring'Pagination'Accessible name of the navigation landmark.
classNamestring-Extra classes, merged after the component's own.

Accessibility

KeyDoes
TabMoves through the page links or buttons
Enter / SpaceGoes to the page

The current page has aria-current="page". Previous and Next stay as disabled buttons at the ends. Use links when every page has its own address.

Accessibility