Skip to content

Accordion List

Divided rows that open by height; closed rows dim until hovered.

$npx shadcn@latest add https://framebrick.co/r/accordion-list.json

From the Nitip template, see it in context.

Positioning, audience research and a clear voice, so every page speaks to the right people.

Layouts, type and motion designed together, tested at every screen size before a line of code.

Fast, accessible sites built on Next.js, with content your team can edit without a developer.

Examples

Cards

Separate cards that open with a click anywhere on them; the open one stays open and turns dark.

Positioning, audience research and a clear voice, so every page speaks to the right people.

Layouts, type and motion designed together, tested at every screen size before a line of code.

Fast, accessible sites built on Next.js, with content your team can edit without a developer.
<AccordionList
  variant="cards"
  icon="plus-minus"
  collapsible={false}
  defaultValue={["design"]}
  className="[&>[data-state=open]]:bg-foreground [&>[data-state=open]]:text-background"
  items={items}
/>

Installation

$ npx shadcn@latest add https://framebrick.co/r/accordion-list.json

Usage

import { AccordionList } from "@/components/ui/accordion-list";

<AccordionList
  defaultValue={["design"]}
  items={[
    { value: "design", marker: "01", title: "Web design", content: "…" },
    { value: "build", marker: "02", title: "Development", content: "…" },
  ]}
/>

// Ciketo's cards: a minus when open, and the open one stays open
<AccordionList
  variant="cards"
  icon="plus-minus"
  collapsible={false}
  defaultValue={["design"]}
  className="[&>[data-state=open]]:bg-foreground [&>[data-state=open]]:text-background"
  items={items}
/>

Props

PropTypeDefaultDescription
items{ value, title, content, marker? }[]—Rows. The marker (number, dot, icon) shows from 640 px up.
type"single" | "multiple""single"Single closes the open row when another opens.
collapsiblebooleantrueIn "single" mode: may the open row be closed by clicking it again? With false it stays open — set `defaultValue` so one starts open.
valuestring[]—Open rows (controlled).
defaultValuestring[][]Initially open rows (uncontrolled).
onValueChange(value: string[]) => void—Called when rows open or close.
dimbooleantrue for the list, false for the cardsClosed rows sit at 70% opacity until hovered (Framer dims to 50%, which fails contrast).
variant"list" | "cards""list"Rows divided by lines, or separate cards 10 px apart that open with a click anywhere on them (Ciketo's).
icon"plus" | "plus-minus""plus"The plus turns into a cross, or the upright bar lies down and fades so it becomes a minus (Ciketo's).
  • Closed panels stay in the HTML (search engines read them) but are inert, so keyboards and screen readers skip them.
  • Ids come from the row's position, so a value with a space in it cannot break aria-controls.
  • In a dimmed row the marker and the icon carry a darker tone: the row's 70% multiplies their colour, and muted-foreground would land at 2.7:1.
  • Every row carries data-state="open" or "closed", so an open card is styled with `data-[state=open]:bg-foreground data-[state=open]:text-background` — the library ships no accent of its own.
  • In the cards a click inside the open panel does not toggle it, so text can be selected and links followed. Ciketo toggles on any click; this is the difference.

AI prompt

Paste into v0, Lovable, Bolt or Claude to rebuild this component in your own project.

Create a React + Tailwind CSS + Motion (motion/react) component called AccordionList.
- Proportions of the shadcn/ui Accordion: rows with border-b (none on the last), trigger py-4 text-sm font-medium.
- Each row: a full-width button with an optional marker (muted, tabular numbers, hidden under 640px), the title and a
  16px muted plus icon.
  Open: the plus rotates 45° into a cross (spring, no bounce, 0.4s).
- The panel animates height 0 → auto with the same spring; its opacity fades in 0.25s after a 0.1s delay and fades out in 0.15s.
- Closed rows are 70% opacity and return to 100% on hover or keyboard focus (0.4s ease-out). The text inside a dimmed
  row (marker, icon) uses text-foreground/95: the row's 70% multiplies its colour, and muted-foreground would fall to 2.7:1.
- Props: items {value,title,content,marker?}[], type single|multiple, collapsible (single mode: may the open row be
  closed again, default true), value/defaultValue/onValueChange (string[]), dim, variant list|cards, icon plus|plus-minus.
- icon "plus-minus": two bars; the horizontal one stays, the vertical one rotates 90° and fades to opacity 0 with a
  spring (bounce 0.2, 0.4s), so the plus becomes a minus.
- variant "cards": a flex column with gap-2.5; each row is rounded-lg border bg-card p-5 and a click anywhere on the card
  toggles it — put the handler on the card, not the button, or it would toggle twice; ignore clicks inside the panel so
  text can be selected. Dim is off unless asked for.
- In the cards, do not name colours for the marker, icon and text: inherit the card's colour and soften with opacity
  (marker and icon 70%, text 80%), so a caller who turns the open card dark gets a readable marker, icon and text.
- Put data-state="open"|"closed" on every row so callers can style the open one.
- Accessibility: aria-expanded / aria-controls on the button, role region + aria-labelledby on the panel,
  closed panels stay rendered but inert.

Be the first to know

Get new templates and components first

One short email when we release a template or a free component. No spam — unsubscribe anytime.

We use your email only for Framebrick updates. Privacy policy