For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
Shadcn Labs/

Expandable Card

A card whose media, title and surface grow into a full dialog and fold back into place. A React component built on View Transitions, installed with the shadcn CLI.

Installation

$ pnpm dlx shadcn@latest add @transition-kit/expandable-card

Usage

import {
  ExpandableCard,
  ExpandableCardBody,
  ExpandableCardContent,
  ExpandableCardDescription,
  ExpandableCardMedia,
  ExpandableCardTitle,
  ExpandableCardTrigger,
} from "@/components/transitions/expandable-card";

Put the same Media, Title and Description in both the trigger and the content. Each pair morphs into the other; Body only shows in the dialog.

<ExpandableCard>
  <ExpandableCardTrigger>
    <ExpandableCardMedia>
      <img src="/aegean.jpg" alt="" />
    </ExpandableCardMedia>
    <ExpandableCardTitle>Aegean Sailing</ExpandableCardTitle>
    <ExpandableCardDescription>Greece · 5 days</ExpandableCardDescription>
  </ExpandableCardTrigger>
  <ExpandableCardContent>
    <ExpandableCardMedia className="aspect-video">
      <img src="/aegean.jpg" alt="" />
    </ExpandableCardMedia>
    <ExpandableCardTitle>Aegean Sailing</ExpandableCardTitle>
    <ExpandableCardDescription>Greece · 5 days</ExpandableCardDescription>
    <ExpandableCardBody>Hop between quiet islands…</ExpandableCardBody>
  </ExpandableCardContent>
</ExpandableCard>
const BookButton = () => {
  const { setOpen } = useExpandableCard();
  return <button onClick={() => setOpen(false)}>Book trip</button>;
};

API Reference

ExpandableCard

PropTypeDefaultDescription
onOpenChange(open: boolean) => void-Called when the card opens or closes.

ExpandableCardContent

Renders a modal <dialog> in document.body. Escape, the backdrop and the close button all fold the card back.

useExpandableCard

ReturnTypeDescription
openbooleanWhether the card is open.
setOpen(open: boolean) => voidOpens or closes with the morph animation.