๐ŸŽจ

UI Library

A collection of beautiful, reusable React components and CSS snippets built with Tailwind CSS and Framer Motion.

Pagination

Controls for navigating through split pages of content.

Basic Pagination

Pagination.tsxLanguage: tsx
import { useState } from 'react'; export function BasicPagination() { const [page, setPage] = useState(3); const total = 5; return ( <nav className="flex items-center gap-2"> <button onClick={() => setPage(Math.max(1, page - 1))} disabled={page === 1} className="p-2 bg-surface border border-border rounded-xl text-foreground hover:bg-black/5 dark:hover:bg-white/5 disabled:opacity-50 disabled:cursor-not-allowed transition-colors" > <svg fill="currentColor" viewBox="0 0 20 20" className="w-5 h-5"><path fillRule="evenodd" d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" clipRule="evenodd" /></svg> </button> {[1, 2, 3, 4, 5].map(p => ( <button key={p} onClick={() => setPage(p)} className={`w-10 h-10 flex items-center justify-center rounded-xl font-semibold transition-colors ${ page === p ? 'bg-accent text-background' : 'text-muted hover:bg-surface border border-transparent hover:border-border hover:text-foreground' }`} > {p} </button> ))} <button onClick={() => setPage(Math.min(total, page + 1))} disabled={page === total} className="p-2 bg-surface border border-border rounded-xl text-foreground hover:bg-black/5 dark:hover:bg-white/5 disabled:opacity-50 disabled:cursor-not-allowed transition-colors" > <svg fill="currentColor" viewBox="0 0 20 20" className="w-5 h-5"><path fillRule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clipRule="evenodd" /></svg> </button> </nav> ); }