Staaarter

Accordion With Live Media

A feature section pairing an accordion list of capabilities with a media panel that updates to match whichever row is active. Clicking a row opens it and swaps the adjacent image, good for a product tour that wants to pair short copy with a supporting screenshot or photo per point.

By Staaarter Team
Feature
Docs
Live preview

Docs

Installation

A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its media-slot dependencies and any missing npm packages, and installs them straight into your project.

npx shadcn add https://staaarter.com/r/accordion-with-live-media.json

Prefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/feature/feature71.tsx instead.

Usage

The file also exports feature71Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.

import { Feature71, feature71Demo } from "@/components/blocks/feature/feature71";

export default function Page() {
  return <Feature71 {...feature71Demo} />;
}

Props

PropTypeDefaultDescription
eyebrowstringnoneSmall label above the heading.
headingReactNodenoneSection heading.
descriptionstringnoneSupporting copy under the heading.
itemsAccordionMediaItem[]noneAccordion rows; each has its own title, description, and image.
classNamestringnoneExtra classes for the outer section element.

Types

type AccordionMediaItem = {
  title: string;
  description: string;
  image: MediaSlotImage; // { src: string; alt: string }
};

Behavior notes

  • Real client-side state: clicking a row sets it active, which both expands its description and swaps the image shown in the side media panel (desktop) or inline beneath the open row (mobile, where the side panel is hidden).
  • This copy-paste block ships with a static image slot via MediaSlot; the brief's 'image, video, or live component' media per row simplifies to image-only here, swap in your own video/embed by replacing the MediaSlot usage.
  • Only one row is open at a time; there is no independent expand/collapse per row, opening a new row closes the previous one.