shadcn.io is not affiliated with official shadcn/ui
Carousel examples · Standard
Hero Carousel for React
A hero carousel whose slides show a headline, a line of copy and a call-to-action button over a gradient.
Homepage heroes, promotional banners, feature announcements: sometimes each slide carries a message, not just a picture. This React carousel lays a headline, a line of copy and a button over each slide, on a gradient that keeps the text readable, with previous and next inside the frame. Use it for a landing page or a few campaigns that share the top of the page.
Preview
Installation
FAQ
When should I use a hero carousel instead of a single hero?
When you have two to four messages of equal weight, such as a launch, a sale and a new feature. People rarely wait for later slides, so put the most important message first. With one clear goal, a single static hero works better.
How do I add a background image?
Put an img with absolute inset-0 size-full object-cover first in the slide's box, before the gradient layer. The demo has no image: the fill is bg-muted under the gradient.
What is the gradient for?
It keeps the text readable on any background. The layer is bg-linear-to-t from-foreground/60 to-transparent, darkest at the bottom, and the text is text-background, so both swap in dark mode. Change the direction (bg-linear-to-b) or the strength (from-foreground/80) to suit your images.
How are previous and next placed inside the slide?
CarouselPrevious gets start-4 and CarouselNext gets end-4, which replace the component's outside positions.
Related
- Standard CarouselA basic carousel of five numbered slides
- Carousel with ThumbnailsA carousel with a row of numbered buttons
- Product Showcase CarouselA product carousel whose cards show an
- Standard CardA basic card with a title, a description
- Button with Text (Standard)The one filled action
- Standard with Title AlertA neutral alert with only a title, for a