Skip to content

Accordion Carousel

An accordion of sections beside a media carousel; opening a section blurs the carousel over to its slides.

1 variantNew

Preview

Installation

Copies the component into components/ui and installs its dependencies and theme tokens.

pnpm dlx shadcn@latest https://floret.shippedui.com/r/accordion-carousel.json

Usage

Pass your own data and wire the callbacks to your app.

import { AccordionCarousel } from "@/components/ui/accordion-carousel";

<AccordionCarousel
  sections={[
    {
      id: "design",
      title: "Design",
      description: "How we explore and decide.",
      slides: [
        { id: "a", heading: "Sketches", media: { type: "image", src: "/a.jpg", alt: "Sketches" } },
        { id: "b", media: { type: "video", src: "/b.mp4", autoPlay: true, loop: true } },
      ],
    },
  ]}
/>

Props

PropTypeDefaultDescription
sections*AccordionCarouselSection[]—Accordion rows, each with its own slides.
defaultSectionIdstring—Section open on mount; defaults to the first.
onSectionChange(id: string) => void—Called when another section is opened.
classNamestring—Merged onto the outer layout.
export type AccordionCarouselSection = {
  id: string;
  title: string;
  description: string;
  slides: CarouselSlide[];
};

export type CarouselSlide = {
  id: string;
  heading?: string;
  summary?: string;
  media:
    | { type: "image"; src: string; alt: string }
    | { type: "video"; src: string; poster?: string; alt?: string;
        autoPlay?: boolean; loop?: boolean; muted?: boolean; controls?: boolean };
};

Credits

This component is built on top of Embla Carousel.