Skip to Content

Carousel

Horizontal or vertical slide carousel powered by Embla Carousel. Supports autoplay, pagination dots, and custom arrow rendering.

Props

PropTypeDefaultDescription
childrenReactNode[]Each child is rendered as a slide
axis'horizontal' | 'vertical''horizontal'Scroll axis
autoPlaybooleanfalseEnable autoplay
intervalnumber3000Autoplay interval in milliseconds
loopbooleantrueLoop back to start when reaching the end
draggablebooleantrueEnable drag/swipe navigation
align'start' | 'center' | 'end''start'Slide alignment
gapnumber | string0Gap between slides
showDotsbooleanfalseShow pagination dots
dotColorstring#d1d5dbDot color
activeDotColorstring#3b82f6Active dot color
dotSizenumber8Dot size in pixels
dotGapnumber8Gap between dots in pixels
showArrowsbooleanfalseShow prev/next arrow buttons
renderPrevArrow(onClick: () => void, enabled: boolean) => ReactNodeCustom previous arrow renderer
renderNextArrow(onClick: () => void, enabled: boolean) => ReactNodeCustom next arrow renderer
onSlideChange(index: number) => voidCalled when the active slide changes
classNamestringContainer className
styleCSSPropertiesContainer style
slideStyleCSSPropertiesStyle applied to each slide wrapper

Ref Handle

MethodDescription
next()Go to the next slide
prev()Go to the previous slide
goTo(index)Jump to a specific slide index
pause()Pause autoplay
resume()Resume autoplay

Example

<Carousel autoPlay interval={4000} showDots loop> <img src="/slide1.jpg" alt="Slide 1" /> <img src="/slide2.jpg" alt="Slide 2" /> <img src="/slide3.jpg" alt="Slide 3" /> </Carousel>
Last updated on