Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Expandable Card

Pro

A card that morphs into a dialog using shared layout animations.

Installation

pnpm dlx shadcn@latest add @viewport/expandable-card

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above comes with Truffle Pro.

Props

PropTypeDefault
title*string—
subtitlestring—
mediaReact.ReactNode

Visual shown at the top of the card, shared between both states.

—
children*React.ReactNode

Content shown only when expanded.

—
classNamestring—

Accessibility

  • Behaves as a modal: focus moves in, Tab is contained, Escape closes.
  • Focus returns to the card on close.
  • Becomes a bottom sheet on phones.