Skip to content

shadcn.io is an independent project built on shadcn/ui

Card with Icon Header Collapsible for React

A card header with an icon tile, Additional Information, a Click to expand line, and a short paragraph.

An icon tile with a plus, the title Additional Information, and a muted Click to expand line. The plus turns into a cross as the card opens onto one short paragraph.

Use it for optional help under a title. If the details should always show, use a Card and leave it open. In React, Base UI only toggles this one region.

Preview

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.
Use email insteadNo credit card

Anatomy

Collapsible anatomy: root, trigger, indicator, content

Usage

<Collapsible className="w-full max-w-lg rounded-lg border bg-card text-card-foreground shadow-sm">
  <CollapsibleTrigger className="group flex w-full items-center gap-3 p-4">
    <span className="flex size-8 shrink-0 items-center justify-center rounded-md bg-primary/10">
      <PlusIcon
        aria-hidden="true"
        className="size-4 text-primary transition-transform duration-200 group-aria-expanded:rotate-45"
      />
    </span>
    <span className="flex flex-1 flex-col text-start">
      <span className="font-medium">Additional Information</span>
      <span className="text-muted-foreground text-sm">Click to expand</span>
    </span>
  </CollapsibleTrigger>
  <CollapsibleContent>
    <div className="border-t px-4 py-3 text-muted-foreground text-sm">
      Here you can find additional details and information about this section.
    </div>
  </CollapsibleContent>
</Collapsible>

FAQ

How is the header laid out?

The trigger is flex items-center gap-3 p-4. First comes a size-8 tile with rounded-md bg-primary/10 holding the plus, then a flex-1 column with the title and the hint line.

What does the trigger announce?

Its text: Additional Information Click to expand. The plus is aria-hidden, so it adds nothing.

Why does the icon box sit in the middle of the two lines?

items-center on the trigger centers the tile against the two-line text block. Use items-start to line it up with the title instead.

How do I swap the plus icon?

Replace PlusIcon with another Lucide icon and keep size-4 text-primary. Drop group-aria-expanded:rotate-45 if the new icon shouldn't turn when the card opens.

Can I remove Click to expand?

Yes. Delete the second line and the title alone names the trigger. The tile stays centered beside it.

How do I start this card open?

Set defaultOpen on Collapsible.

The card starts closed.

API Reference

Collapsible

No extra props in this demo. The rest is on the Collapsible page.