Back to Component Explorer
Compact Dots Step Pagination
paginationsMinimalist expandable dot indicators for carousels and multi-step flows.
#pagination#dots#carousel#steps
Live Interactive Preview
Component Source Code
Select language in the dropdownCompactDotsPagination.tsx
1'use client';23import React, { useState } from 'react';4import { ChevronLeft, ChevronRight } from 'lucide-react';56export default function CompactDotsPagination() {7 const [activeStep, setActiveStep] = useState(1);8 const totalSteps = 6;910 return (11 <div className="w-full max-w-xs sm:max-w-sm rounded-2xl border border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-900 p-4 shadow-lg flex items-center justify-between transition-colors">12 <button13 onClick={() => setActiveStep((s) => Math.max(0, s - 1))}14 disabled={activeStep === 0}15 className="flex h-8 w-8 items-center justify-center rounded-xl border border-slate-200 dark:border-slate-800 bg-slate-50 dark:bg-slate-800 text-slate-700 dark:text-slate-300 hover:bg-slate-100 dark:hover:bg-slate-700 disabled:opacity-30 transition"16 aria-label="Previous Step"17 >18 <ChevronLeft className="h-4 w-4" />19 </button>2021 <div className="flex items-center gap-1.5">22 {Array.from({ length: totalSteps }).map((_, idx) => (23 <button24 key={idx}25 onClick={() => setActiveStep(idx)}26 className={`h-2.5 rounded-full transition-all duration-300 ${27 activeStep === idx28 ? 'w-7 bg-blue-600 shadow-sm'29 : 'w-2.5 bg-slate-200 dark:bg-slate-800 hover:bg-slate-300 dark:hover:bg-slate-700'30 }`}31 aria-label={`Go to step ${idx + 1}`}32 />33 ))}34 </div>3536 <button37 onClick={() => setActiveStep((s) => Math.min(totalSteps - 1, s + 1))}38 disabled={activeStep === totalSteps - 1}39 className="flex h-8 w-8 items-center justify-center rounded-xl border border-slate-200 dark:border-slate-800 bg-slate-50 dark:bg-slate-800 text-slate-700 dark:text-slate-300 hover:bg-slate-100 dark:hover:bg-slate-700 disabled:opacity-30 transition"40 aria-label="Next Step"41 >42 <ChevronRight className="h-4 w-4" />43 </button>44 </div>45 );46}Installation & Integration Guide
Step 1: Tailwind CSS v4 Setup
Tailwind DocsIf you do not have Tailwind installed yet, run this installation command:
Terminal
npm install tailwindcss @tailwindcss/postcss postcss
Then add the Tailwind directive to your main stylesheet (globals.css):
@import "tailwindcss";
Step 2: Install Icon Dependencies
npm install lucide-react react-icons
Step 3: Add Component File
Create a new file in your project at src/components/paginations/CompactDotsPagination.tsx and paste the copied code from the source viewer above.
Step 4: Usage Example
ExamplePage.tsx
1import CompactDotsStepPagination from '@/components/paginations/CompactDotsPagination';23export default function ExamplePage() {4 return (5 <main className="p-8 flex items-center justify-center min-h-screen">6 <CompactDotsStepPagination />7 </main>8 );9}