pagination
gr8monk3ys/paginationFreeComponent
pagination (identity-styled).
Install it
npx shadcn@latest add https://ui.lscaturchio.xyz/r/pagination.jsonSource
1import * as React from "react"2import {3 ChevronLeftIcon,4 ChevronRightIcon,5 MoreHorizontalIcon,6} from "lucide-react"78import { cn } from "@/lib/utils"9import { buttonVariants, type Button } from "@/components/ui/button"1011function Pagination({ className, ...props }: React.ComponentProps<"nav">) {12 return (13 <nav14 role="navigation"15 aria-label="pagination"16 data-slot="pagination"17 className={cn("mx-auto flex w-full justify-center", className)}18 {...props}19 />20 )21}2223function PaginationContent({24 className,25 ...props26}: React.ComponentProps<"ul">) {27 return (28 <ul29 data-slot="pagination-content"30 className={cn("flex flex-row items-center gap-1", className)}31 {...props}32 />33 )34}3536function PaginationItem({ ...props }: React.ComponentProps<"li">) {37 return <li data-slot="pagination-item" {...props} />38}3940type PaginationLinkProps = {41 isActive?: boolean42} & Pick<React.ComponentProps<typeof Button>, "size"> &43 React.ComponentProps<"a">4445function PaginationLink({46 className,47 isActive,48 size = "icon",49 ...props50}: PaginationLinkProps) {51 return (52 <a53 aria-current={isActive ? "page" : undefined}54 data-slot="pagination-link"55 data-active={isActive}56 className={cn(57 buttonVariants({58 variant: isActive ? "outline" : "ghost",59 size,60 }),61 className62 )}63 {...props}64 />65 )66}6768function PaginationPrevious({69 className,70 ...props71}: React.ComponentProps<typeof PaginationLink>) {72 return (73 <PaginationLink74 aria-label="Go to previous page"75 size="default"76 className={cn("gap-1 px-2.5 sm:pl-2.5", className)}77 {...props}78 >79 <ChevronLeftIcon />80 <span className="hidden sm:block">Previous</span>81 </PaginationLink>82 )83}8485function PaginationNext({86 className,87 ...props88}: React.ComponentProps<typeof PaginationLink>) {89 return (90 <PaginationLink91 aria-label="Go to next page"92 size="default"93 className={cn("gap-1 px-2.5 sm:pr-2.5", className)}94 {...props}95 >96 <span className="hidden sm:block">Next</span>97 <ChevronRightIcon />98 </PaginationLink>99 )100}101102function PaginationEllipsis({103 className,104 ...props105}: React.ComponentProps<"span">) {106 return (107 <span108 aria-hidden109 data-slot="pagination-ellipsis"110 className={cn("flex size-9 items-center justify-center", className)}111 {...props}112 >113// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from gr8monk3ys
All 69 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | gr8monk3ys | Components | Free | 2 deps | |
| ActiveNavLinkactive-nav-link | gr8monk3ys | Components | Free | no deps · 2 files | |
| alertalert | gr8monk3ys | Components | Free | 1 dep | |
| alert-dialogalert-dialog | gr8monk3ys | Components | Free | 1 dep | |
| aspect-ratioaspect-ratio | gr8monk3ys | Components | Free | 1 dep | |
| attachmentattachment | gr8monk3ys | Components | Free | 2 deps | |
| Avataravatar | gr8monk3ys | Components | Free | 1 dep | |
| Badgebadge | gr8monk3ys | Components | Free | 1 dep |
