keshon

Accordion

Component

About

A vertically stacked set of collapsible sections for showing or hiding content one row at a time, built on Base UI's accordion primitive.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Accordion to your project and fits it to your theme.

Code

How Accordion is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import Accordion from "@/components/ui/accordion";

const withArchive = [
  { value: "contact", label: "Contact", description: "Who to call, and when" },
  { value: "deal", label: "Deal", description: "Stage, amount, next step" },
  { value: "history", label: "History" },
  {
    value: "archive",
    label: "Archived notes",
    description: "Closed by the admin",
    disabled: true,
  },
];

const leadSectionText: Record<string, string> = {
  contact:
    "Aigul Safina, head of procurement. Mornings, Kazan time; she prefers a call to an email.",
  deal: "Negotiation, 1.2M \u20bd. The next step is the revised offer, due Friday.",
  history:
    "First contact at the Innoprom fair in July; two demos since, the second with their IT lead.",
  archive: "",
};

export default function AccordionDisabledDemo() {
  return (
    <div className="w-full max-w-md bg-white p-6">
      <Accordion items={withArchive} defaultValue={["contact"]}>
        {(item) => leadSectionText[item.value]}
      </Accordion>
    </div>
  );
}

Dependencies

More by keshon

View all
  • List

    List

    4
  • Turn

    Turn

  • Sparkline

    Sparkline

  • Streaming Text Caret

    Streaming Text Caret

  • Thinking

    Thinking

  • Lanes

    Lanes

  • Key Value List

    Key Value List

  • Status Dot

    Status Dot