structyl

Carousel API

View component

The full prop reference for the Carousel component. A slideshow for cycling through images or content.

Import

tsx
import { Carousel } from '@structyl/styled';

Props

Root

The root carousel container that manages state, navigation, and autoplay

PropTypeDefault
loop#boolean

Enable wrapping navigation (cycles back to start when reaching end)

false
autoPlay#number

Autoplay interval in milliseconds; pauses on hover

slideCount#number

Total number of slides (used by Dots/Counter components)

0
index#number

Controlled current slide index

defaultIndex#number

Initial slide index when uncontrolled

0
onIndexChange#(index: number) => void

Callback fired when active slide index changes

className#string

CSS class name

asChild#boolean

Render as child element (primitives only)

orientation#'horizontal' | 'vertical'

Carousel direction (primitives only)

'horizontal'
...rest#React.ComponentPropsWithoutRef<'div'>

All standard HTML div attributes and event handlers

Content

Container for carousel slides; includes viewport and slide container

PropTypeDefault
className#string

CSS class name

...rest#React.ComponentPropsWithoutRef<'div'>

All standard HTML div attributes and event handlers

Item

Individual carousel slide container

PropTypeDefault
className#string

CSS class name

...rest#React.ComponentPropsWithoutRef<'div'>

All standard HTML div attributes and event handlers

Previous

Button to navigate to previous slide; auto-disabled when at start and loop is false

PropTypeDefault
className#string

CSS class name

...rest#React.ComponentPropsWithoutRef<'button'>

All standard HTML button attributes and event handlers

Next

Button to navigate to next slide; auto-disabled when at end and loop is false

PropTypeDefault
className#string

CSS class name

...rest#React.ComponentPropsWithoutRef<'button'>

All standard HTML button attributes and event handlers

Dots

Dot indicators for slide navigation; shows current position and allows direct navigation

PropTypeDefault
count#number

Number of slides; falls back to slideCount from Root context

className#string

CSS class name

...rest#React.HTMLAttributes<HTMLDivElement>

All standard HTML div attributes

Counter

Slide counter display showing current position (e.g., '3 / 5')

PropTypeDefault
count#number

Total number of slides; falls back to slideCount from Root context

className#string

CSS class name

...rest#React.HTMLAttributes<HTMLSpanElement>

All standard HTML span attributes

Source code

If you didn't find what you need here, read the component implementation .

structyl — Accessible React Component Library