Carousel
A composable card carousel with horizontal scroll, keyboard and button navigation.
Slide 1 of 4
npx shadcn@latest add @roiui/carouselnpx shadcn@latest add @roiui/carousel-tailwindanatomy
The main carousel component that manages state and provides context.
Component props
Prop
Type
Default
Name
totalItemsDescription
Total number of items in the carousel
Type
numberDefault
-
Name
gapDescription
Gap between carousel items in pixels
Type
numberDefault
16Name
variantDescription
Carousel variant. Use 'inset' to align with parent container bounds
Type
"default" | "inset"Default
"default"Name
alignDescription
Alignment of carousel content
Type
"start" | "center"Default
"start"Name
indexDescription
Controlled index value
Type
numberDefault
-
Name
defaultIndexDescription
Default index for uncontrolled mode
Type
numberDefault
0Name
onIndexChangeDescription
Callback when index changes
Type
functionDefault
-
Name
classNameDescription
Additional CSS classes to apply to the carousel container
Type
stringDefault
-
Wrapper that extends carousel to full viewport width.
Component props
Prop
Type
Default
Name
classNameDescription
Additional CSS classes to apply to the bleed container
Type
stringDefault
-
Scrollable viewport container with hidden scrollbars.
Component props
Prop
Type
Default
Name
classNameDescription
Additional CSS classes to apply to the viewport
Type
stringDefault
-
Flex container for horizontal layout with pseudo elements for spacing.
Component props
Prop
Type
Default
Name
classNameDescription
Additional CSS classes to apply to the content container
Type
stringDefault
-
Component props
Prop
Type
Default
Name
indexDescription
The index of the item in the carousel
Type
numberDefault
-
Name
classNameDescription
Additional CSS classes to apply to the item
Type
stringDefault
-
Container for navigation buttons with default Previous/Next rendering.
Component props
Prop
Type
Default
Name
classNameDescription
Additional CSS classes to apply to the navigation container
Type
stringDefault
-
Name
childrenDescription
Custom navigation buttons (defaults to Previous and Next)
Type
ReactNodeDefault
-
Previous button that auto-disables at start.
Component props
Prop
Type
Default
Name
classNameDescription
Additional CSS classes to apply to the previous button
Type
stringDefault
-
Name
childrenDescription
Custom content for the previous button (defaults to left arrow icon)
Type
ReactNodeDefault
-
Next button that auto-disables at end.
Component props
Prop
Type
Default
Name
classNameDescription
Additional CSS classes to apply to the next button
Type
stringDefault
-
Name
childrenDescription
Custom content for the next button (defaults to right arrow icon)
Type
ReactNodeDefault
-
Dot indicators for each item (hidden when only one item).
Component props
Prop
Type
Default
Name
classNameDescription
Additional CSS classes to apply to the indicators container
Type
stringDefault
-