Adventureland Registry

Item Pagination

Previous/next navigation controls for sequenced content items, supporting both Link-based and button-based modes.

ItemPagination renders up/down chevron controls for moving between ordered items. It has two layout modes: a compact inline variant for desktop toolbars (isMobile={false}, the default) and a full-width bottom bar for mobile viewports (isMobile={true}). Either mode can render as <Link> elements (default) or as <button> elements when useButtons is set.

Installation

npx shadcn@latest add @adv/item-pagination

Usage

import { ItemPagination } from '@/components/ui/ItemPagination';

<ItemPagination
  prevItem={{ id: 'alpha', title: 'Alpha Project' }}
  nextItem={{ id: 'gamma', title: 'Gamma Project' }}
  basePath="/work/acme"
/>

Example

Props

PropTypeDefaultDescription
prevItem{ id: string; title: string } | nullData for the previous item. Pass null to render a disabled control.
nextItem{ id: string; title: string } | nullData for the next item. Pass null to render a disabled control.
basePathstringBase path used to build hrefs: ${basePath}/${item.id}.
isMobilebooleanfalseRenders a full-width bottom navigation bar instead of the compact inline layout.
onClick{ onPrevClick?: () => void; onNextClick?: () => void }Click handlers used when useButtons is true.
useButtonsbooleanfalseRender <button> elements instead of <Link> elements.
prefetchbooleanfalsePassed through to Next.js <Link prefetch>.
prevButtonRefRefObject<HTMLButtonElement | null>Ref attached to the previous button (desktop mode, useButtons only).
nextButtonRefRefObject<HTMLButtonElement | null>Ref attached to the next button (desktop mode, useButtons only).

On this page