Pagination
blok/paginationFreeComponent
Pagination with page navigation, next and previous links.
Install it
npx shadcn@latest add https://blok.sitecore.com/r/pagination.jsonSource
1import { mdiChevronLeft, mdiChevronRight, mdiDotsHorizontal } from "@mdi/js";2import type * as React from "react";34import { type Button, buttonVariants } from "@/components/ui/button";5import { Icon } from "@/lib/icon";6import { cn } from "@/lib/utils";78function Pagination({ className, ...props }: React.ComponentProps<"nav">) {9 return (10 <nav11 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("flex flex-row items-center gap-1", className)}27 {...props}28 />29 );30}3132function PaginationItem({ ...props }: React.ComponentProps<"li">) {33 return <li data-slot="pagination-item" {...props} />;34}3536type PaginationLinkProps = {37 isActive?: boolean;38} & Pick<React.ComponentProps<typeof Button>, "size"> &39 React.ComponentProps<"a">;4041function PaginationLink({42 className,43 isActive,44 size = "icon",45 ...props46}: PaginationLinkProps) {47 return (48 <a49 aria-current={isActive ? "page" : undefined}50 data-slot="pagination-link"51 data-active={isActive}52 className={cn(53 buttonVariants({54 colorScheme: "neutral",55 size,56 }),57 "text-neutral-fg bg-transparent disabled:text-neutral-fg/40 font-medium hover:bg-neutral-bg active:bg-primary-bg",58 isActive &&59 "bg-primary-bg text-neutral-fg hover:bg-primary-bg active:bg-primary-bg font-medium",60 className,61 )}62 {...props}63 />64 );65}6667function PaginationPrevious({68 className,69 ...props70}: React.ComponentProps<typeof PaginationLink>) {71 return (72 <PaginationLink73 aria-label="Go to previous page"74 size="icon"75 className={cn("gap-1 px-2.5 sm:pl-2.5", className)}76 {...props}77 >78 <Icon path={mdiChevronLeft} size={1} />79 </PaginationLink>80 );81}8283function PaginationNext({84 className,85 ...props86}: React.ComponentProps<typeof PaginationLink>) {87 return (88 <PaginationLink89 aria-label="Go to next page"90 size="icon"91 className={cn("gap-1 px-2.5 sm:pr-2.5", className)}92 {...props}93 >94 <Icon path={mdiChevronRight} size={1} />95 </PaginationLink>96 );97}9899function PaginationEllipsis({100 className,101 ...props102}: React.ComponentProps<"span">) {103 return (104 <span105 aria-hidden106// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from blok
All 72 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | blok | Components | Free | 2 deps · 2 files | |
| Action baraction-bar | blok | Components | Free | 1 dep · 2 files | |
| Alertalert | blok | Components | Free | 2 deps · 2 files | |
| Alert dialogalert-dialog | blok | Components | Free | 2 deps | |
| Aspect ratioaspect-ratio | blok | Components | Free | 1 dep | |
| Avataravatar | blok | Components | Free | 1 dep | |
| Badgebadge | blok | Components | Free | 2 deps | |
| All componentsblok-components | blok | Components | Free | no deps |
