Web · Components
Carousel
Scrolling slideshow: from a single image to product strips, from story-style intros to a seamless logo ticker.
Live example
Preview

Morning in Cappadocia
1slide

Aegean bays
2slide

Black Sea highlands
3slide

Sunset on the Mediterranean
4slide

Eastern Express
5slide

Pamukkale travertines
6slide
Code
Events
- Events appear here when you interact with the preview.
Seamless loop: keep swiping past the end

Morning in Cappadocia
1slide

Aegean bays
2slide

Black Sea highlands
3slide

Sunset on the Mediterranean
4slide

Eastern Express
5slide

Pamukkale travertines
6slide
Story style: bars fill up, holding pauses

Morning in Cappadocia

Aegean bays

Black Sea highlands

Sunset on the Mediterranean
Product strip: 1.5 / 3 / 4 cards by width, page by page

Product 1
Free shipping
₺149

Product 2
Free shipping
₺298

Product 3
Free shipping
₺447

Product 4
Free shipping
₺596

Product 5
Free shipping
₺745

Product 6
Free shipping
₺894

Product 7
Free shipping
₺1043

Product 8
Free shipping
₺1192

Product 9
Free shipping
₺1341

Product 10
Free shipping
₺1490

Product 11
Free shipping
₺1639
Logo stream (marquee): slows to a stop on hover, draggable
Controlled from outside (ref) and a custom active state

Morning in Cappadocia
1slide

Aegean bays
2slide

Black Sea highlands
3slide

Sunset on the Mediterranean
4slide

Eastern Express
5slide

Pamukkale travertines
6slide
Import
Scrolling slideshow: from a single image to product strips, from story-style intros to a seamless logo ticker.
- Seamless loop (`loop`): the first slide comes right after the last; while dragging, on the wheel, with arrows and in autoplay the track always flows the same way, no rewind or jump is visible.
- Natural motion: dragging that follows the finger, momentum on flick, settling with a spring animation, a rubber band effect at the edges. Doesn't block vertical page scrolling; scrolled horizontally with two fingers on a touchpad.
- Flexible layout:
slidesPerView(fractional,"auto"or by width),gap,align,step, vertical direction, RTL. - Controls: arrows, dots / lines / counter / thumbnails, keyboard (←/→, Home/End),
next()/goTo()viaref. - Autoplay with a progress indicator; marquee flow;
fade,scaleor your own transition effect. - Accessible: the WAI-ARIA carousel pattern; invisible slides leave the Tab order and a focused slide comes into view.
- Fast: motion doesn't enter React state; every frame only writes
transform.
A client component; can be used with children from a server component.
Examples
ResponsiveValue
typeValue that changes with the container width: a single value or a { min_width_px: value } object. Breakpoints look at the carousel's own width, not the screen (container query), so it works correctly in a sidebar and on a full page, and renders correctly on the server.
Examples
CarouselEffect
typeSlide transition look.
"slide": slides side by side."fade": stacked, cross-fading while dragging (one slide)."scale": slides; slides moving away from the center shrink and fade.- Function: called every frame for each slide; receives the slide's distance from its aligned position (in slides, signed:
-1the previous,0.5halfway) and returns the style for the inner box.
Indicators.
"dots": dots; the active one stretches (fills during autoplay)."lines": story-style lines; the active line fills during autoplay."count": a3 / 8counter."thumbnails": a thumbnail strip (withthumbnails).false: none.
CarouselAutoplay
interfaceAutoplay settings.
| Name | Type | Default | Description |
|---|---|---|---|
delay? | number | 5000 | Time spent on a slide (ms). |
pauseOnHover? | boolean | true | Pauses while the pointer is over it. |
stopOnInteraction? | boolean | false | Stops permanently when the user drags or presses an arrow or a dot (restarts with the play button). With false only the timer restarts. |
CarouselHandle
interfaceFor controlling Carousel from outside (ref).
| Name | Type | Description |
|---|---|---|
next | () => void | Next slide(s). In a loop it moves seamlessly from the last to the first slide. |
prev | () => void | Previous slide(s). |
goTo | (index: number, options?: { instant?: boolean; }) => void | Go to a slide; without animation with instant. |
play | () => void | Start autoplay. |
pause | () => void | Stop autoplay. |
index | number | Selected slide. |
CarouselClassNames
interfaceClasses added to the parts.
| Name | Type | Description |
|---|---|---|
viewport? | string | The visible (clipping) area. |
track? | string | Track carrying the slides. |
slide? | string | Box of each slide. |
arrow? | string | Arrow buttons. |
indicators? | string | Indicator bar. |
CarouselProps
interfaceProps of the Carousel component.
| Name | Type | Default | Description |
|---|---|---|---|
children | ReactNode | Slides: every top-level child is a slide. | |
label? | string | "Karusel" | Screen reader name. |
loop? | boolean | false | Infinite loop. Keep scrolling after the last slide and the first slide comes right after it; the track never rewinds or jumps to the start. Arrows, autoplay, wheel and dragging work the same way. Slides are cloned automatically when there aren't enough to fill the area. |
slidesPerView? | ResponsiveValue<number | "auto"> | 1 | Number of visible slides. Can be fractional (1.2 shows the edge of the next one). "auto": every slide has its own width. See ResponsiveValue. |
gap? | ResponsiveValue<number | string> | 16 | Gap between slides: px or a CSS length. |
align? | CarouselAlign | "start" | Alignment of a slide in the visible area. |
step? | number | "page" | 1 | How many slides one move advances; "page" as many as are visible. |
orientation? | "horizontal" | "vertical" | "horizontal" | Direction. height must be given for vertical. |
height? | number | string | Height of a vertical carousel: px or a CSS length. | |
index? | number | Selected slide in controlled use. | |
defaultIndex? | number | 0 | First slide in uncontrolled use. |
onIndexChange? | (index: number) => void | Called when the selected slide changes (also while dragging). | |
onSettle? | (index: number) => void | Called when motion ends and the slide settles. | |
autoplay? | boolean | number | CarouselAutoplay | Autoplay: true, a delay (ms) or settings. Pauses while hovered, on keyboard focus, while dragging, while the tab is hidden and while the carousel is off screen. A play/pause button is added. Starts paused when "reduce motion" is on. See CarouselAutoplay. | |
marquee? | boolean | number | Continuous flow (logo/news ticker): the track scrolls constantly at this speed (px/s); negative values go the other way. true = 40. Turns the loop on automatically; draggable, returns to flowing on release; slows to a stop on hover. | |
effect? | CarouselEffect | "slide" | Transition look. See CarouselEffect. |
arrows? | boolean | "always" | true | Previous/next arrows. true: visible on mouse hover, hidden on touch (swipe instead). "always": always visible. |
indicators? | CarouselIndicators | "dots" | Indicators. See CarouselIndicators. |
indicatorsPlacement? | "inside" | "outside" | "outside" | Whether the indicators are over the slide ("inside") or below it. |
thumbnails? | readonly (string | ReactNode)[] | Thumbnails (indicators="thumbnails"): a URL or an element, in slide order. | |
draggable? | boolean | true | Draggable with mouse and touch. |
snap? | boolean | true | Snaps to slides. false: scrolls freely and glides to a slow stop on release. |
skipSnaps? | boolean | false | A fast flick can skip multiple slides. |
wheel? | boolean | true | Scrolling with the touchpad and a horizontal wheel (a vertical wheel keeps scrolling the page; Shift+wheel scrolls the carousel). |
rewind? | boolean | false | Without a loop, the arrow at an edge goes to the other end (rewinds). Autoplay without a loop always returns to the start at the end. |
duration? | number | 500 | Approximate duration of the settle animation (ms). |
ref? | Ref<CarouselHandle> | Control from outside. See CarouselHandle. | |
className? | string | Classes added to the root element. | |
classNames? | CarouselClassNames | Classes added to the parts. See CarouselClassNames. | |
style? | CSSProperties | Style of the root element. |
CarouselAlign
typeWhere a slide aligns within the visible area.