Pagination
Page navigation. 3 styles.
import * as React from "react";
import { Pagination } from "@/components/ui/pagination";
export default function Example() {
const [page, setPage] = React.useState(3);
return <Pagination page={page} pageCount={9} onPageChange={setPage} />;
}
Installation
$ npx uix-ui@latest add paginationThis copies the file into components/ui/pagination.tsx in your project. npx shadcn@latest add @uix/pagination works too.
Usage
import { Pagination } from "@/components/ui/pagination";
<Pagination page={page} pageCount={9} onPageChange={setPage} />
Props
| Prop | Type | Default | Description |
|---|---|---|---|
appearance | outline | ghost | filled | "outline" | |
page | number | – | Current page, starting at 1. |
pageCount | number | – | |
onPageChange | (page: number) => void | – | |
siblings | number | 1 | Pages shown on each side of the current one. |
Everything else is passed to the root element, so className, aria-* and event handlers work as usual.
Dependencies
Installed for you by the CLI.
class-variance-authorityclsxtailwind-merge
lib/utils.tscomponents/ui/icons.tsx