Skip to content

Pagination

Page navigation controls with multiple display variants (numbered pages, count summary, compact label, or none).

function Default() {
const [page, setPage] = useState(1);
return <Pagination onChange={setPage} page={page} totalPages={10} />;
}
function CountVariant() {
const [page, setPage] = useState(1);
return (
<Pagination
onChange={setPage}
page={page}
totalItems={95}
variant="count"
/>
);
}
function CompactVariant() {
const [page, setPage] = useState(1);
return (
<Pagination
onChange={setPage}
page={page}
totalPages={10}
variant="compact"
/>
);
}
function NoneVariant() {
const [page, setPage] = useState(1);
return (
<Pagination
onChange={setPage}
page={page}
totalPages={10}
variant="none"
/>
);
}
function SmallSize() {
const [page, setPage] = useState(1);
return (
<Pagination onChange={setPage} page={page} size="sm" totalPages={10} />
);
}
<Pagination isDisabled onChange={() => {}} page={3} totalPages={10} />
function UnknownTotal() {
const [page, setPage] = useState(1);
return (
<Pagination
hasMore={page < 5}
onChange={setPage}
page={page}
variant="none"
/>
);
}
function ManyPages() {
const [page, setPage] = useState(50);
return <Pagination onChange={setPage} page={page} totalPages={100} />;
}
function CustomSiblingCount() {
const [page, setPage] = useState(10);
return (
<Pagination
onChange={setPage}
page={page}
siblingCount={2}
totalPages={20}
/>
);
}
Current page: 1
function Controlled() {
const [page, setPage] = useState(1);
const totalPages = 10;
return (
<div style={{display: 'flex', flexDirection: 'column', gap: '1rem'}}>
<div style={{display: 'flex', gap: '0.5rem', alignItems: 'center'}}>
<span>Current page: {page}</span>
<button onClick={() => setPage(1)} type="button">
Reset
</button>
<button onClick={() => setPage(totalPages)} type="button">
Go to last
</button>
</div>
<Pagination onChange={setPage} page={page} totalPages={totalPages} />
</div>
);
}

Page navigation controls with multiple display variants (numbered pages, count summary, compact label, or none).

When Variant 1

PropTypeDefaultDescription
classNamestringAdditional CSS class names applied to the navigation root.
data-testidstringTest ID applied to the navigation root.
hasMorebooleanWhether another page exists when the total page count is unknown.
isDisabledbooleanfalseWhether the pagination controls are disabled.
labelstring'Pagination'Accessible label for the navigation landmark.
onChange*(page: number) => voidCalled when the page changes.
page*numberCurrent page number, starting at 1.
pageSizenumber10Number of items per page.
refRef<HTMLElement>Ref forwarded to the navigation root.
siblingCountnumber1Number of page buttons to show on each side of the current page.
size"sm" | "md" | "lg"'md'Control size.
styleCSSPropertiesInline styles applied to the navigation root.
variant"none" | "count" | "pages" | "compact"'pages'Display variant.
totalItems*number
totalPagesnever

When Variant 2

PropTypeDefaultDescription
classNamestringAdditional CSS class names applied to the navigation root.
data-testidstringTest ID applied to the navigation root.
hasMorebooleanWhether another page exists when the total page count is unknown.
isDisabledbooleanfalseWhether the pagination controls are disabled.
labelstring'Pagination'Accessible label for the navigation landmark.
onChange*(page: number) => voidCalled when the page changes.
page*numberCurrent page number, starting at 1.
pageSizenumber10Number of items per page.
refRef<HTMLElement>Ref forwarded to the navigation root.
siblingCountnumber1Number of page buttons to show on each side of the current page.
size"sm" | "md" | "lg"'md'Control size.
styleCSSPropertiesInline styles applied to the navigation root.
variant"none" | "count" | "pages" | "compact"'pages'Display variant.
totalItemsnever
totalPages*number

When Variant 3

PropTypeDefaultDescription
classNamestringAdditional CSS class names applied to the navigation root.
data-testidstringTest ID applied to the navigation root.
hasMorebooleanWhether another page exists when the total page count is unknown.
isDisabledbooleanfalseWhether the pagination controls are disabled.
labelstring'Pagination'Accessible label for the navigation landmark.
onChange*(page: number) => voidCalled when the page changes.
page*numberCurrent page number, starting at 1.
pageSizenumber10Number of items per page.
refRef<HTMLElement>Ref forwarded to the navigation root.
siblingCountnumber1Number of page buttons to show on each side of the current page.
size"sm" | "md" | "lg"'md'Control size.
styleCSSPropertiesInline styles applied to the navigation root.
variant"none" | "count" | "pages" | "compact"'pages'Display variant.
totalItemsnever
totalPagesnever