npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-pagination.json --yesPagination
ProThe row of page numbers with previous and next under a long table or list, to move between its pages, for React and Tailwind CSS. Part of Goop Pro.
What an agent sees
- PaginationContentThe row in Pagination
- PaginationListThe run of pages and gaps, a list of its own inside one item of the row, with the same gap between its places
- PaginationItemOne place in the row or in its run
- PaginationLinkA link to one page by its number, in a PaginationItem
- PaginationPreviousThe link to the page before, as the theme's quiet 28 px link
- PaginationNextThe link to the page after, as the theme's quiet 28 px link
- PaginationEllipsisThe pages left out
- PaginationPagesA ready pagination row that works out its own pages
import {
Pagination, PaginationContent, PaginationList, PaginationItem, PaginationLink, PaginationPrevious, PaginationNext, PaginationEllipsis, PaginationPages, pageRange,
} from '@/components/ui/goop/pagination';
import { useState } from 'react';
function NotesPages() {
const [page, setPage] = useState(1);
return (
<>
<Pagination aria-label="Pages of notes">
<PaginationPages page={page} pageCount={12} href={(n) => `?page=${n}`} onPageChange={setPage} />
</Pagination>
{/* a hand-picked run of pages, written with the parts */}
<Pagination>
<PaginationContent>
<PaginationItem>
<PaginationPrevious href="?page=2" />
</PaginationItem>
<PaginationItem>
<PaginationList>
<PaginationItem>
<PaginationLink href="?page=1">1</PaginationLink>
</PaginationItem>
<PaginationItem>
<PaginationEllipsis />
</PaginationItem>
<PaginationItem>
<PaginationLink href="?page=3" isActive>
3
</PaginationLink>
</PaginationItem>
<PaginationItem>
<PaginationLink href="?page=4">4</PaginationLink>
</PaginationItem>
</PaginationList>
</PaginationItem>
<PaginationItem>
<PaginationNext href="?page=4" />
</PaginationItem>
</PaginationContent>
</Pagination>
</>
);
}Turn the pages of twenty-three orders, two a page, by number or with Previous and Next; the ends switch off at the first and the last page, and a gap stands for the pages not shown, the row seven places on every page. The orders are our own sample rows in the page; nothing is fetched per page.
When to use
- The row of page numbers with previous and next under a long table or list, to move between its pages.
- Also called: pager.
Installation
Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Pagination on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-pagination.json --yesAdd the Goop Pagination to this project. The install steps are at https://goop.so/docs/install.mdUsage
import {
Pagination, PaginationContent, PaginationList, PaginationItem, PaginationLink, PaginationPrevious, PaginationNext, PaginationEllipsis, PaginationPages, pageRange,
} from '@/components/ui/goop/pagination';
import { useState } from 'react';
function NotesPages() {
const [page, setPage] = useState(1);
return (
<>
<Pagination aria-label="Pages of notes">
<PaginationPages page={page} pageCount={12} href={(n) => `?page=${n}`} onPageChange={setPage} />
</Pagination>
{/* a hand-picked run of pages, written with the parts */}
<Pagination>
<PaginationContent>
<PaginationItem>
<PaginationPrevious href="?page=2" />
</PaginationItem>
<PaginationItem>
<PaginationList>
<PaginationItem>
<PaginationLink href="?page=1">1</PaginationLink>
</PaginationItem>
<PaginationItem>
<PaginationEllipsis />
</PaginationItem>
<PaginationItem>
<PaginationLink href="?page=3" isActive>
3
</PaginationLink>
</PaginationItem>
<PaginationItem>
<PaginationLink href="?page=4">4</PaginationLink>
</PaginationItem>
</PaginationList>
</PaginationItem>
<PaginationItem>
<PaginationNext href="?page=4" />
</PaginationItem>
</PaginationContent>
</Pagination>
</>
);
}- Fits: list (its recipe).
- PaginationPages: Every page is a real link to
href(page); withonPageChangea plain click turns the page in place instead and the caller setspage. For a hand-picked run of pages write the parts:PaginationContent,PaginationList,PaginationLink. - height, width, padding, gap, text: add no class for these.
API reference
| Option | Type | What it does |
|---|---|---|
| Defaults | aria-label = 'Pagination' |
| Part | What it is |
|---|---|
| PaginationContent | The row in Pagination; PaginationPrevious, a PaginationList, then PaginationNext, each in an item |
| PaginationList | The run of pages and gaps, a list of its own inside one item of the row, with the same gap between its places |
| PaginationItem | One place in the row or in its run |
| PaginationLink | A link to one page by its number, in a PaginationItem; mark the page shown with isActive; isActive?: boolean = false — This is the page shown: aria-current="page", and the pill's current look; pageLabel?: string — The word said before the page's number in its spoken name ("Page" 3, the default), the caller's to translate; also takes href?: string |
| PaginationPrevious | The link to the page before, as the theme's quiet 28 px link; label?: string = 'Previous' — The link's words and spoken name; disabled?: boolean = false — No page that way: the link stays, dimmed, but leads nowhere and takes no tab stop; also takes href?: string |
| PaginationNext | The link to the page after, as the theme's quiet 28 px link; label?: string = 'Next' — The link's words and spoken name; disabled?: boolean = false — No page that way: the link stays, dimmed, but leads nowhere and takes no tab stop; also takes href?: string |
| PaginationEllipsis | The pages left out; label?: string = 'More pages' — The dots' spoken name |
| PaginationPages | A ready pagination row that works out its own pages; its props: pagination--pages.md |
- pageRange
- data-slot values (to select a part by): pagination, pagination-content, pagination-ellipsis, pagination-item, pagination-link, pagination-list, pagination-next, pagination-previous
PaginationPages
A ready pagination row that works out its own pages.
import { PaginationPages } from '@/components/ui/goop/pagination';Options
- page: number — The page shown, from 1.
- pageCount: number — How many pages the list has.
- siblings?: number = 1 — Pages shown either side of the page shown.
- boundaries?: number = 1 — Pages always shown at each end.
- href: (page: number) => string — The address of a page by its number (
(n) => "?page=" + n): every page, previous and next link there. - onPageChange?: (page: number) => void — Called with the page a plain click asks for; the click's own navigation is stopped.
- pageLabel?: string — The word said before each page's number ("Page" 3, the default), the caller's to translate.
- previousLabel?: string = 'Previous' — Previous's words, the caller's to translate.
- nextLabel?: string = 'Next' — Next's words, the caller's to translate.
- gapLabel?: string = 'More pages' — What the dots stand for, said to a reader.
Keyboard
| Key | What it does |
|---|---|
| Tab | Move to the next link |
Accessibility
- The part itself answers the keys above.
Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:
| State | Drawn by |
|---|---|
| disabled | the attribute aria-disabled |
Notes for AI
Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.