Carousel Navigator Free React component
Pagination dots for a carousel: the active dot stretches into a pill that fills up like a progress bar before moving to the next slide.
Original component by Watermelon UI · MIT licence
Get the code
npx shadcn@latest add https://registry.watermelon.sh/r/carousel-navigator.jsonInstalls from the Watermelon UI registry through the shadcn CLI. Needs Tailwind CSS and the motion package, which the command adds for you.
import { CarouselNavigator } from '../carousel-navigator';
import { useState, useEffect } from "react";
const customThemes = [
{
bg: "bg-[#F4F4F9]",
button: "bg-[#262629]",
dot: "bg-[#D5D4E0]",
progress: "bg-[#D5D4E0]",
},
{
bg: "bg-[#E7F1FD]",
button: "bg-[#016FFE]",
dot: "bg-[#89BCF9]",
progress: "bg-[#89BCF9]",
},
{
bg: "bg-[#E0FAE7]",
button: "bg-[#2EBE50]",
dot: "bg-[#38E363]",
progress: "bg-[#38E363]",
},
{
bg: "bg-[#FCF5DB]",
button: "bg-[#FEC400]",
dot: "bg-[#FAD34C]",
progress: "bg-[#FAD34C]",
},
];
export default function CarouselNavigatorDemo() {
const [currentIndex, setCurrentIndex] = useState(0);
const totalSlides = 4;
const autoDelay = 4000;
useEffect(() => {
const timer = setInterval(() => {
setCurrentIndex((prev) => (prev + 1) % totalSlides);
}, autoDelay);
return () => clearInterval(timer);
}, [currentIndex]);
return (
<div className="flex justify-center items-center">
<CarouselNavigator
totalSlides={totalSlides}
autoDelay={autoDelay}
themes={customThemes}
currentIndex={currentIndex}
onIndexChange={setCurrentIndex}
/>
</div>
);
}Paste this into Claude, ChatGPT, Cursor, Lovable or v0 to build it from scratch.
Build a React component called "Carousel Navigator" with Tailwind CSS and Motion (motion/react). Pagination dots for a carousel: the active dot stretches into a pill that fills up like a progress bar before moving to the next slide. Use spring transitions, keep it accessible with keyboard focus and aria labels, respect prefers-reduced-motion, and make it work on touch screens. Export it as a single .tsx file with sensible default props so it renders a complete demo on its own.How the carousel navigator works
Pagination dots for a carousel: the active dot stretches into a pill that fills up like a progress bar before moving to the next slide. The component is a single TypeScript file built with React, Tailwind CSS and Motion, so the animation runs on springs and shared layouts instead of hand-written keyframes.
It comes from Watermelon UI, an open-source component library released under the MIT licence. Install it with the shadcn command above, or copy the source from the code tab into your project.
Frequently asked questions
Want motion like this on your website?
We design and build custom websites with motion, 3D and SEO built in. Websites from $500.