Components

Expandable Card

Expandable Card is a reusable interactive card component for showing a compact preview first, then expanding to reveal more details, supporting descriptions, actions, and optional learn-more links.

interactivemotionanimationcardaccessibility

Installation

$npx shadcn@latest add https://ui.navdeepsingh.dev/r/expandable-card.json

API Reference

PropTypeDefaultDescription
titlestring-Card title, shown in both the collapsed and expanded states.
descriptionstring-Short summary shown in the preview and again when expanded.
imagestring-Optional cover image URL shown in the media area.
iconReact.ReactNode-Optional icon/media node, used in the media area when no `image` is set.
itemsExpandableCardItem[][]Detail rows revealed in the expanded state. Each item is { title, description }.
footerReact.ReactNode-Custom footer/actions rendered in the expanded state.
learnMore{ label?: string; href?: string; onClick?: () => void }-Optional learn-more link (when `href`) or action (when `onClick`) rendered in the expanded state.
openboolean-Controlled open state. Use with `onOpenChange`.
defaultOpenbooleanfalseUncontrolled initial open state.
onOpenChange(open: boolean) => void-Called whenever the open state changes (controlled or uncontrolled).
classNamestring-Classes merged onto the collapsed card.

Customization

  • Pass className to restyle the component. Classes are merged with cn, so your utilities win.
  • Styling uses Tailwind utility classes and theme tokens, so it adapts to light/dark mode automatically.
  • Tune behavior with the props in the API reference above, for example title.