npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-pagination.json --yesPagination
ProThe row of steps to the page before and the page after, at the foot of a page that is one of a run (a settings section, a guide's chapter), for React and Tailwind CSS. Part of Goop Pro.
What an agent sees
- PaginationPreviousThe step to the page before
- PaginationNextThe step to the page after
- PaginationContentThe numbered row in a Pagination
- PaginationListA run of pages and gaps, a list of its own in one item of the row, its places 4 px apart, wrapping centred
- PaginationItemOne place in the row or in its run
- PaginationLinkA link to one page by its number, in a PaginationItem
- PaginationEllipsisThe pages left out
- PaginationPagesA ready pagination row that works out its own pages
import { PaginationContent, PaginationList, PaginationItem, PaginationLink, PaginationEllipsis } from '@/components/ui/goop/pagination';
import {
Pagination,
PaginationNext,
PaginationPages,
PaginationPrevious,
} from '@/components/ui/goop/pagination';
const SECTIONS = ['General', 'Members', 'Profile', 'Notifications', 'Calendars'];
function SettingsFoot({ page }: { page: number }) {
const before = SECTIONS[page - 1];
const after = SECTIONS[page + 1];
return (
<Pagination>
{before ? <PaginationPrevious title={before} href={`/settings/${before.toLowerCase()}`} /> : null}
{after ? <PaginationNext title={after} href={`/settings/${after.toLowerCase()}`} /> : null}
</Pagination>
);
}
function VisitPages({ page, onPage }: { page: number; onPage: (page: number) => void }) {
return (
<Pagination aria-label="Site visits">
<PaginationPages page={page} pageCount={12} href={(n) => `?page=${n}`} onPageChange={onPage} />
</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 steps to the page before and the page after, at the foot of a page that is one of a run (a settings section, a guide's chapter).
- 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>/meadow-pagination.json --yesAdd the Goop Pagination to this project. The install steps are at https://goop.so/docs/install.mdUsage
import { PaginationContent, PaginationList, PaginationItem, PaginationLink, PaginationEllipsis } from '@/components/ui/goop/pagination';
import {
Pagination,
PaginationNext,
PaginationPages,
PaginationPrevious,
} from '@/components/ui/goop/pagination';
const SECTIONS = ['General', 'Members', 'Profile', 'Notifications', 'Calendars'];
function SettingsFoot({ page }: { page: number }) {
const before = SECTIONS[page - 1];
const after = SECTIONS[page + 1];
return (
<Pagination>
{before ? <PaginationPrevious title={before} href={`/settings/${before.toLowerCase()}`} /> : null}
{after ? <PaginationNext title={after} href={`/settings/${after.toLowerCase()}`} /> : null}
</Pagination>
);
}
function VisitPages({ page, onPage }: { page: number; onPage: (page: number) => void }) {
return (
<Pagination aria-label="Site visits">
<PaginationPages page={page} pageCount={12} href={(n) => `?page=${n}`} onPageChange={onPage} />
</Pagination>
);
}- The row is as wide as its caller and splits it in two: put it last in the page's column (
<Pagination className="mt-auto">in a column that fills the view keeps it at the foot). - PaginationPages: Every page is a real link to
href(page), so a page opens in a new tab; withonPageChangea plain click turns the page in place instead (the click's own navigation stopped) and the caller setspage. The row takes the whole of the Pagination's width, its places centred. - height, width, padding, gap, corner, background, text, motion: add no class for these.
API reference
| Option | Type | What it does |
|---|---|---|
| Defaults | aria-label = 'Pagination' |
| Part | What it is |
|---|---|
| PaginationPrevious | The step to the page before; its props: pagination--previous.md |
| PaginationNext | The step to the page after; title?: ReactNode — The neighbouring page's name, the step's large words: given, the wide grey step of a settings page's foot; left out, the numbered row's quiet 28 px step, its arrow and its label; label?: string = 'Next' — The step's words: the small word under the name (or the quiet step's words), the caller's to translate; disabled?: boolean — No page that way: the step stays, dimmed, but leads nowhere — no address, no tab stop, no press (aria-disabled); onClick?: MouseEventHandler<HTMLAnchorElement | HTMLButtonElement> — The step's press: on a link as on any link; with no href the step is a button that fires it; also takes href?: string |
| PaginationContent | The numbered row in a Pagination |
| PaginationList | A run of pages and gaps, a list of its own in one item of the row, its places 4 px apart, wrapping centred |
| PaginationItem | One place in the row or in its run |
| PaginationLink | A link to one page by its number, in a PaginationItem; takes asChild; isActive?: boolean = false — This is the page shown: aria-current="page", and the selected grey fill; pageLabel?: string = 'Page' — 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 |
| 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 |
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; 1 by default.
- boundaries?: number = 1 — Pages always shown at each end; 1 by default.
- 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 = 'Page' — 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.
PaginationPrevious
The step to the page before.
import { PaginationPrevious } from '@/components/ui/goop/pagination';Options
- title?: ReactNode — The neighbouring page's name, the step's large words: given, the wide grey step of a settings page's foot; left out, the numbered row's quiet 28 px step, its arrow and its
label. - label?: string = 'Previous' — The step's words: the small word under the name (or the quiet step's words), the caller's to translate.
- disabled?: boolean — No page that way: the step stays, dimmed, but leads nowhere — no address, no tab stop, no press (
aria-disabled). - onClick?: MouseEventHandler<HTMLAnchorElement | HTMLButtonElement> — The step's press: on a link as on any link; with no
hrefthe step is a button that fires it. - Also takes: href?: string
Keyboard
| Key | What it does |
|---|---|
| Enter | Activate |
| Space | Activate |
Accessibility
- The native element answers the keyboard.
- hover, active, focus-visible: the browser's own (:hover, :active, :focus-visible): write nothing
Motion
- The part sets its own motion: add no transition or animation of your own.
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.