- Accordion
- Action BarUpdated
- Alert Dialog
- Alert
- Announcement
- Aspect Ratio
- Autocomplete
- Avatar
- BadgeUpdated
- Bottom Navigation
- Breadcrumb
- Button Group
- Button
- CalendarUpdated
- CardUpdated
- Carousel
- Chart
- Checkbox
- Circular Progress
- Circular Slider
- Clipboard
- Collapsible
- Color Picker
- Combobox
- Command
- Context MenuUpdated
- Data List
- Date Picker
- DialogUpdated
- DrawerUpdated
- Editable
- FieldUpdated
- File Upload
- Float
- Floating Panel
- Frame
- Hint
- Hover Card
- Image Cropper
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Link Overlay
- Listbox
- MarqueeUpdated
- Menu
- Native Select
- Number InputUpdated
- Pagination
- Popover
- Progress
- Prose
- QR Code
- Radio Group
- Rating
- Resizable
- Scroll Area
- Segment Group
- Select
- Separator
- Sheet
- Sidebar
- Signature Pad
- Skeleton
- Skip Nav
- Slider
- Spinner
- Status
- Steps
- Switch
- TableUpdated
- Tabs
- Textarea
- TimerUpdated
- ToastUpdated
- Toggle Group
- Toggle Tooltip
- Toggle
- Tooltip
- Tour
- Tree View
Installation#
pnpm dlx shadcn@latest add @shark/carousel
Anatomy#
Carousel ├── CarouselContent │ └── CarouselItem ├── CarouselControl │ ├── CarouselPrevious │ └── CarouselNext └── CarouselIndicatorGroup └── CarouselIndicator
Usage#
import { Carousel, CarouselControl, CarouselItem, CarouselContent, CarouselIndicator, CarouselIndicatorGroup, CarouselNext, CarouselPrevious, } from "@/components/ui/carousel";
<Carousel> <CarouselControl> <CarouselPrevious>Previous</CarouselPrevious> <CarouselNext>Next</CarouselNext> </CarouselControl> <CarouselContent> <CarouselItem /> <CarouselItem /> </CarouselContent> </Carousel>
Orientation#
Horizontal#
Vertical#
Thumbnail Indicators#
Render each thumbnail inside CarouselIndicator to create a visual preview of each slide.
Horizontal#
Vertical#
Examples#
Autoplay#
Use autoplay props on Carousel to make the carousel play automatically.
Loop#
Use loop prop to make the carousel loop.
Controlled#
Use page and onPageChange props to control the carousel state programmatically.
Current page: 1 of 5
Slides Per Page#
Display multiple slides simultaneously by setting the slidesPerPage prop on Carousel.
Spacing#
Control the gap between slides using the spacing prop on Carousel.
Mouse Drag#
To allow mouse drag, set the allowMouseDrag prop on Carousel.
API Reference#
Carousel#
Root component. Manages slide state and navigation.
| Prop | Type | Default |
|---|---|---|
slideCount | number | required |
allowMouseDrag | boolean | false |
autoplay | boolean | { delay: number } | false |
defaultPage | number | 0 |
loop | boolean | false |
orientation | "horizontal" | "vertical" | "horizontal" |
page | number | - |
slidesPerPage | number | 1 |
slidesPerMove | number | 'auto' | 'auto' |
spacing | string | "16px" |
padding | number | 0 |
className | string | - |
CarouselContent#
Wraps all slides. Handles layout and transitions.
| Prop | Type | Default |
|---|---|---|
className | string | - |
asChild | boolean | false |
CarouselItem#
Wraps a single slide.
| Prop | Type | Default |
|---|---|---|
index | number | required |
snapAlign | "start" | "center" | "end" | "start" |
className | string | - |
asChild | boolean | false |
CarouselControl#
Holds prev/next navigation buttons.
| Prop | Type | Default |
|---|---|---|
className | string | - |
asChild | boolean | false |
CarouselPrevious#
Goes to the previous slide.
| Prop | Type | Default |
|---|---|---|
className | string | - |
CarouselNext#
Goes to the next slide.
| Prop | Type | Default |
|---|---|---|
className | string | - |
CarouselIndicatorGroup#
Holds slide indicator dots or pills.
| Prop | Type | Default |
|---|---|---|
className | string | - |
asChild | boolean | false |
CarouselIndicator#
Indicator for a slide. Click to jump to that slide.
| Prop | Type | Default |
|---|---|---|
index | number | required |
readOnly | boolean | false |
className | string | - |
asChild | boolean | false |
For a complete list of props, see the Ark UI documentation.