Skip to content
synccn

Pagination

Page numbers with ellipses for long ranges.

Page 6 of 20

Playground

Change the props and copy the code. The controls come from the component's TypeScript types.

Props

total20
siblings1
import { Pagination } from "@/components/ui/pagination";<Pagination total={20} />

Installation

$ pnpm dlx shadcn@latest add @synccn/pagination

First time in this project? Connect synccn with one command.

Usage

import { Pagination } from "@/components/ui/pagination";<Pagination total={20} />

API reference

Generated from the component's TypeScript types, so it always matches the code.

  • totalrequired
    number

    Number of pages.

  • page
    number

    Controlled current page (1-based).

  • defaultPage
    number

    Default 1

    Initial page when uncontrolled.

  • onPageChange
    (page: number) => void

    Called with the new page.

  • siblings
    number

    Default 1

    Pages shown either side of the current one.

  • className
    string

    Extra classes for the root element.

Dependencies

Read from the component's imports when the site builds. The CLI installs all of these for you.

Helpers

  • lib/utilscn (merges class names)
  • lib/hooksuseControllable (works controlled or uncontrolled)

npm packages

Accessibility

  • The current page is marked with aria-current="page".

From the source

Read from this component's code when the site builds, so it can't drift.

  • ARIA attributes: aria-current, aria-label
  • Shows a visible focus ring for keyboard users