Skip to content
synccn

Carousel

Swipeable slides with arrows, dots, autoplay and multi-item views.

Components
Blocks
Themes
Motion
Charts
1
2
3
4
5
6
7
8

Installation

$ pnpm dlx shadcn@latest add @synccn/carousel

First time in this project? Connect synccn with one command.

Usage

import { Carousel } from "@/components/ui/carousel";<Carousel perView={3} autoplay={4000}>…</Carousel>

API reference

Generated from the component's TypeScript types, so it always matches the code.

Carousel

Scroll-snap carousel: swipe, drag-free on touch, arrow buttons, dots, keyboard arrows and optional autoplay (paused on hover and focus, off for reduced motion).

  • perView
    number

    Default 1

    Slides visible at once.

  • gap
    number

    Default 12

    Space between slides in pixels.

  • autoplay
    number

    Default 0

    Milliseconds between automatic slides. 0 turns it off.

  • loop
    boolean

    Default true

    Wrap from the last slide to the first.

  • children
    React.ReactNode

    Content to render.

  • className
    string

    Extra classes for the root element.

Dependencies

Read from the component's imports when the site builds. The CLI installs all of these for you.

Helpers

npm packages

Keyboard

  • ←or→Previous or next slide, when the carousel has focus

Accessibility

  • Autoplay pauses on hover and focus, and is off for people who prefer reduced motion.

From the source

Read from this component's code when the site builds, so it can't drift.

  • ARIA roles: group, region
  • ARIA attributes: aria-current, aria-label, aria-roledescription
  • Keys handled: ArrowLeft, ArrowRight
  • Respects the reduced motion setting
  • Shows a visible focus ring for keyboard users