Cnippet

Collapsible

Cards 1

About

A minimal show/hide primitive built on Base UI's Collapsible. A trigger toggles a height-animated panel — perfect for read-more text, FAQ rows, nested groups and expandable log output. Controlled or uncontrolled via open / defaultOpen, with data-panel-open styling hooks. Ships Collapsible, CollapsibleTrigger and CollapsiblePanel (also exported as CollapsibleContent).

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

Code

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

Usage.tsx

import { ChevronDownIcon } from "lucide-react";
import {
  Collapsible,
  CollapsibleContent,
  CollapsibleTrigger,
} from "@/components/ui/cnippet-collapsible";

export default function CollapsibleCard() {
  return (
    <div className="w-full max-w-xs">
      <div className="rounded-xl border bg-card px-3 py-4 text-card-foreground shadow-sm">
        <Collapsible>
          <CollapsibleTrigger className="flex w-full cursor-pointer items-center justify-between gap-4 text-sm">
            <span>How do I reset my password?</span>
            <ChevronDownIcon
              aria-hidden="true"
              className="size-4 shrink-0 in-data-panel-open:rotate-180 text-muted-foreground transition-transform"
            />
          </CollapsibleTrigger>
          <CollapsibleContent>
            <div className="pt-3 text-muted-foreground text-sm">
              You can reset your password by clicking the &quot;Forgot
              Password&quot; link on the login page. We&apos;ll send you an email
              with instructions to create a new password.
            </div>
          </CollapsibleContent>
        </Collapsible>
      </div>
    </div>
  );
}

Dependencies

More by Cnippet

View all
  • Team

    Team

    1.3K
  • Davincho Hero-1

    Davincho Hero-1

    683
  • Aero Hero-3

    Aero Hero-3

    558
  • Features

    Features

    510
  • Random Letter Swap Navigation

    Random Letter Swap Navigation

    487
  • Services with Animated Hover Modal

    Services with Animated Hover Modal

    465
  • Blogs

    Blogs

    396
  • Aero Hero-1

    Aero Hero-1

    356

More in Cards

View all
  • Statistics Card 2

    Statistics Card 2

    264
  • Course Design Cards

    Course Design Cards

    1.1K
  • Card

    Card

    70
  • Stats cards with links

    Stats cards with links

    39
  • The Item one

    The Item one

    3
  • Card Studio

    Card Studio

    7
  • Statistics Card 7

    Statistics Card 7

    292
  • Item

    Item

    10