Expandable Data Card

Use Expandable Data Card to keep a key metric visible while revealing its breakdown in the same surface. The card grows inline, so the detail stays connected to the summary without an overlay.

Preview

Reduce motion:Off
Tune:Off
Inspect

Total revenue

$39,820

Sep 1 to Sep 30

+12.8%

Installation

Basic usage

TypeScript
revenue-card.tsx

Usage

API

PropertyTypeDefaultDescription
titlestringrequiredShort label describing the data shown in the card.
summaryReactNoderequiredAlways-visible summary content, such as a metric and its change.
childrenReactNoderequiredAdditional data revealed when the card expands.
openbooleanundefinedControlled expanded state.
defaultOpenbooleanfalseInitial expanded state when uncontrolled.
onOpenChange(open: boolean) => voidundefinedCalled when the user opens or closes the card.
classNamestringundefinedAdditional classes for the card surface.

Accessibility

The Details button exposes its expanded state and maintains a stable connection to the detail container. The card title labels the revealed region. Exiting content becomes inert immediately, and focus returns to the Details button if a controlled close would remove the focused element. Reduced-motion users receive the same content without the morphing transition.

Detail content unmounts after closing. Keep any form values or other state that must survive reopening in the parent component.

Styling

CLI installation registers the shadow utilities automatically. For manual installation, install shadow-plugin and add @plugin "shadow-plugin"; to your Tailwind v4 stylesheet.

The component owns the expandable surface and interaction. Supply your own metric summary and detail content, and use className to adapt the card width or surface color.

Was this page helpful?

Your response helps us improve component docs.