shadcn.io is not affiliated with official shadcn/ui
Carousel examples · Standard
Carousel with Thumbnails for React
A carousel with a row of numbered buttons that show the current slide and jump to any slide.
Ever scrolled through product photos and wanted to jump straight to the fourth one? This React carousel puts a row of numbered buttons under the slides. The button of the current slide is filled, and pressing any button shows its slide, whether you got there by swiping or by the buttons. Use it for product galleries, property listings or portfolios.
Preview
Installation
FAQ
How do the buttons stay in sync with the slides?
setApi stores the carousel's API. An effect listens to its select event and stores selectedScrollSnap() in current, and each button calls scrollTo with its index.
What does each slide show?
Five slides. Each is an aspect-2/1 box with rounded-md border bg-background and the slide number in font-semibold text-4xl. The carousel and the buttons stack in a max-w-md column with gap-4.
How are the buttons styled?
A flex justify-center gap-2 row of Buttons, one per slide. The current one is variant="default", the others variant="outline". Change those, or the size, to restyle them.
Can I show pictures instead of numbers?
Yes. Put a small img in each button, with a fixed size such as size-12 and object-cover, and keep the aria-label so each button still has a name.
Related
- Standard CarouselA basic carousel of five numbered slides
- Product Showcase CarouselA product carousel whose cards show an
- Hero CarouselA hero carousel whose slides show a
- Image CardA listing card with a full-width photo
- Basic TabsFour horizontal tabs that switch between
- Standard DialogA share dialog with a read-only link, a