Glass Pagination
washiveil/glass-paginationFreeComponent
Pagination pills on the ghost-circle register.
Install it
npx shadcn@latest add https://washiveil.alexchih.com/r/glass-pagination.jsonSource
1import * as React from 'react';2import { ChevronLeft, ChevronRight, MoreHorizontal } from 'lucide-react';34import { cn } from '@/lib/utils';56function GlassPagination({ className, ...props }: React.ComponentProps<'nav'>) {7 return <nav role="navigation" aria-label="pagination" className={cn('mx-auto flex w-full justify-center', className)} {...props} />;8}910function GlassPaginationContent({ className, ...props }: React.ComponentProps<'ul'>) {11 return <ul className={cn('flex items-center gap-2', className)} {...props} />;12}1314function GlassPaginationItem({ ...props }: React.ComponentProps<'li'>) {15 return <li {...props} />;16}1718const ghostCircle =19 'grid size-9 place-items-center rounded-full border border-foreground/10 text-muted-foreground transition-colors hover:border-ruri hover:text-ruri dark:border-white/10 dark:hover:border-ruri-soft dark:hover:text-ruri-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background';2021const activePill = 'font-medium border-transparent bg-ruri text-white dark:bg-ruri-soft dark:text-deep';2223interface GlassPaginationLinkProps extends React.ComponentProps<'a'> {24 isActive?: boolean;25}2627function GlassPaginationLink({ isActive, className, ...props }: GlassPaginationLinkProps) {28 return (29 <a30 aria-current={isActive ? 'page' : undefined}31 className={cn(ghostCircle, isActive && activePill, className)}32 {...props}33 />34 );35}3637function GlassPaginationPrevious({ className, ...props }: React.ComponentProps<'a'>) {38 return (39 <a aria-label="Go to previous page" className={cn(ghostCircle, className)} {...props}>40 <ChevronLeft className="size-4" />41 <span className="sr-only">Previous</span>42 </a>43 );44}4546function GlassPaginationNext({ className, ...props }: React.ComponentProps<'a'>) {47 return (48 <a aria-label="Go to next page" className={cn(ghostCircle, className)} {...props}>49 <ChevronRight className="size-4" />50 <span className="sr-only">Next</span>51 </a>52 );53}5455function GlassPaginationEllipsis({ className, ...props }: React.ComponentProps<'span'>) {56 return (57 <span className={cn('grid size-9 place-items-center text-faint', className)} {...props}>58 <MoreHorizontal className="size-4" />59 <span className="sr-only">More pages</span>60 </span>61 );62}6364export {65 GlassPagination,66 GlassPaginationContent,67 GlassPaginationItem,68 GlassPaginationLink,69 GlassPaginationPrevious,70// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from washiveil
All 58 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Ambient Fieldambient-field | washiveil | Components | Free | no deps | |
| Chipchip | washiveil | Components | Free | 1 dep | |
| Code Badgecode-badge | washiveil | Components | Free | no deps | |
| Glass Accordionglass-accordion | washiveil | Components | Free | 2 deps | |
| Glass Alertglass-alert | washiveil | Components | Free | 1 dep | |
| Glass Alert Dialogglass-alert-dialog | washiveil | Components | Free | 1 dep | |
| Glass Aspect Ratioglass-aspect-ratio | washiveil | Components | Free | 1 dep | |
| Glass Avatarglass-avatar | washiveil | Components | Free | 1 dep |
