export const title = "Carousel components" export const description = "Free and open-source React carousel components built for modern applications and websites. These carousels are built using Embla Carousel and styled with Tailwind CSS." export const links = { github: "https://github.com/untitleduico/react/tree/main/components/application/carousel", embla: "https://www.embla-carousel.com/", } import * as Demos from "@/components/application/carousel/carousel.story.tsx"; ## Installation You can add this carousel component using our CLI or manually: ```bash npx untitledui@latest add carousel-base ``` As our carousel component is built with [Embla Carousel](https://www.embla-carousel.com/), you'll need to install the dependencies: ```bash npm install embla-carousel-react ``` Copy the files below into your project: Great! Now you can start using the carousel components in your project by just copy/pasting our examples below. ## Carousel examples Below are examples and variations of this carousel component: ### Carousel md {{ tocOnly:true }} ### Carousel lg {{ tocOnly:true }} ## API reference api?.scrollTo(page - 1)}`. The examples also pass `framed`, plus `size=\"lg\"` on the larger carousel.", }, { question: "How do I show more than one slide at a time?", answer: "Each `Carousel.Item` defaults to `basis-full`, so override it via `className` — for example `className=\"basis-1/2 md:basis-1/3\"` for a responsive multi-item carousel. Add spacing by putting a gap utility on `Carousel.Content`.", }, { question: "Is the carousel keyboard accessible?", answer: "Yes, for horizontal carousels. `Carousel.Root` handles the Left and Right arrow keys while focus is inside it, such as on a trigger, and renders with `role=\"region\"` and `aria-roledescription=\"carousel\"`, while each `Carousel.Item` renders as `role=\"group\"` with `aria-roledescription=\"slide\"`. The triggers get default `aria-label` values of \"Previous slide\" and \"Next slide\". Only the Left and Right keys are wired up, so an `orientation=\"vertical\"` carousel needs its own Up and Down key handling.", }, ]} />