Pagination
rivelle/paginationFreeComponent
Server-safe navigation for paged content.
Live preview
live · rendered by the registry
Rendered by rivelle on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://rivelle.dev/r/pagination.jsonSource
1import * as React from "react";2import { ChevronLeft, ChevronRight, MoreHorizontal } from "lucide-react";34import { cn } from "@/lib/utils";5import { buttonVariants } from "@/components/ui/button";67function Pagination({ className, ...props }: React.ComponentProps<"nav">) {8 return (9 <nav10 role="navigation"11 aria-label="pagination"12 data-slot="pagination"13 className={cn("mx-auto flex w-full justify-center", className)}14 {...props}15 />16 );17}1819function PaginationContent({20 className,21 ...props22}: React.ComponentProps<"ul">) {23 return (24 <ul25 data-slot="pagination-content"26 className={cn(27 "flex items-center gap-1 rounded-2xl border border-foreground/10 bg-background/70 p-1.5 shadow-[inset_0_1px_0_color-mix(in_oklch,var(--background)_75%,transparent)]",28 className,29 )}30 {...props}31 />32 );33}3435function PaginationItem(props: React.ComponentProps<"li">) {36 return <li data-slot="pagination-item" {...props} />;37}3839type PaginationLinkProps = React.ComponentProps<"a"> & {40 isActive?: boolean;41 size?: "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg";42};4344function PaginationLink({45 className,46 isActive,47 size = "icon-sm",48 ...props49}: PaginationLinkProps) {50 return (51 <a52 aria-current={isActive ? "page" : undefined}53 data-slot="pagination-link"54 data-active={isActive}55 className={cn(56 buttonVariants({ variant: isActive ? "secondary" : "ghost", size }),57 "hover:-translate-y-0",58 className,59 )}60 {...props}61 />62 );63}6465function PaginationPrevious({66 className,67 ...props68}: React.ComponentProps<typeof PaginationLink>) {69 return (70 <PaginationLink71 aria-label="Go to previous page"72 size="sm"73 className={cn("gap-1 pl-2.5", className)}74 {...props}75 >76 <ChevronLeft />77 <span className="hidden sm:inline">Previous</span>78 </PaginationLink>79 );80}8182function PaginationNext({83 className,84 ...props85}: React.ComponentProps<typeof PaginationLink>) {86 return (87 <PaginationLink88 aria-label="Go to next page"89 size="sm"90 className={cn("gap-1 pr-2.5", className)}91 {...props}92 >93 <span className="hidden sm:inline">Next</span>94 <ChevronRight />95 </PaginationLink>96 );97}9899function PaginationEllipsis({100 className,101 ...props102}: React.ComponentProps<"span">) {103 return (104 <span105 aria-hidden106 data-slot="pagination-ellipsis"107 className={cn(108// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from rivelle
All 83 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | rivelle | Components | Free | 2 deps | |
| Alertalert | rivelle | Components | Free | 1 dep | |
| Alert Dialogalert-dialog | rivelle | Components | Free | 1 dep | |
| Aspect Ratioaspect-ratio | rivelle | Components | Free | 1 dep | |
| Avataravatar | rivelle | Components | Free | 1 dep | |
| Badgebadge | rivelle | Components | Free | 2 deps | |
| Breadcrumbbreadcrumb | rivelle | Components | Free | 2 deps | |
| Buttonbutton | rivelle | Components | Free | 2 deps |
