Pagination
weekendsuperhero-io-sistine/paginationUnverifiedComponent
Pagination with page navigation with optional glass material.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/Weekendsuperhero-io/sistine/main/pagination.jsonSource
1import { ArrowsHorizontalIcon, CaretLeftIcon, CaretRightIcon } from "@phosphor-icons/react";2import * as React from "react";3import { type MaterialAxisProps, materialSurface, splitAxisProps } from "@/lib/material";4import { cn } from "@/lib/utils";5import { type Button, buttonVariants } from "./button";67/* Role: bordered adaptive glass. */8const ROLE = {9 border: true,10};1112const Pagination = ({ className, ...props }: React.ComponentProps<"nav">) => (13 <nav aria-label="pagination" data-slot="pagination" className={cn("mx-auto flex w-full justify-center", className)} {...props} />14);15Pagination.displayName = "Pagination";1617const PaginationContent = React.forwardRef<18 HTMLUListElement,19 React.ComponentProps<"ul"> &20 MaterialAxisProps & {21 variant?: "default" | "glass";22 }23>(({ className, variant = "glass", ...props }, ref) => {24 const [axes, rest] = splitAxisProps(props);25 /* Variant classes carry BEHAVIOR only; the surface comes from materialSurface. */26 const variants = {27 default: "",28 glass: "rounded-lg px-2 py-1",29 };3031 const m = materialSurface(variant === "default" ? null : ROLE, axes);3233 return (34 <ul35 ref={ref}36 data-slot="pagination-content"37 data-material={m?.["data-material"]}38 className={cn(m?.className, "flex flex-row items-center gap-1", variants[variant], className)}39 {...rest}40 />41 );42});43PaginationContent.displayName = "PaginationContent";4445const PaginationItem = React.forwardRef<HTMLLIElement, React.ComponentProps<"li">>(({ className, ...props }, ref) => (46 <li ref={ref} data-slot="pagination-item" className={cn("", className)} {...props} />47));48PaginationItem.displayName = "PaginationItem";4950type PaginationLinkProps = {51 isActive?: boolean;52} & Pick<React.ComponentProps<typeof Button>, "size"> &53 React.ComponentProps<"a"> &54 MaterialAxisProps & {55 variant?: "default" | "glass";56 };5758const PaginationLink = ({ className, isActive, size = "icon", variant = "glass", ...props }: PaginationLinkProps) => {59 const [axes, rest] = splitAxisProps(props);60 // The glass surface rides the ACTIVE page only; inactive links keep the plain outline/ghost button look.61 const m = variant === "glass" && isActive ? materialSurface(ROLE, axes) : null;6263 return (64 <a65 aria-current={isActive ? "page" : undefined}66 data-slot="pagination-link"67 data-active={isActive}68 data-material={m?.["data-material"]}69 className={cn(70 m?.className,71 buttonVariants({72// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from weekendsuperhero-io/sistine
All 71 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | weekendsuperhero-io/sistine | Components | Unverified | 5 deps · 4 files | |
| Alertalert | weekendsuperhero-io/sistine | Components | Unverified | 3 deps · 4 files | |
| Alert Dialogalert-dialog | weekendsuperhero-io/sistine | Components | Unverified | 4 deps · 4 files | |
| Auto Foregroundauto-foreground | weekendsuperhero-io/sistine | Components | Unverified | no deps | |
| Avataravatar | weekendsuperhero-io/sistine | Components | Unverified | 4 deps · 4 files | |
| Badgebadge | weekendsuperhero-io/sistine | Components | Unverified | 4 deps · 4 files | |
| Breadcrumbbreadcrumb | weekendsuperhero-io/sistine | Components | Unverified | 5 deps · 4 files | |
| Buttonbutton | weekendsuperhero-io/sistine | Components | Unverified | 4 deps · 4 files |
