# Morphing Card

> Click the card and the card becomes the dialog.

It grows from where it sits into a centred panel, its face staying at the top while details unfold, and shrinks back on close.

- Family: Cards
- Plan: Creative. Included with Creative.
- Requires: React, Tailwind CSS v4 and the motion package
- Page with a live preview: https://galactrex.com/ui/morphing-card/
- Licence: https://galactrex.com/ui/license/

## Install

```sh
npx @galactrex/ui login   # once, with an API key from https://galactrex.com/account/
npx @galactrex/ui add morphing-card
```

It installs to `components/galactrex/morphing-card.tsx`, with the shared motion helpers beside it. First time in a project: `npx @galactrex/ui init` (setup guide: https://galactrex.com/docs/ui-components-setup/).

## Usage

```tsx
import { MorphingCard } from "@/components/galactrex/morphing-card";

<MorphingCard label="Orbit" details={<p>…</p>}><h3>Orbit</h3></MorphingCard>
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` | — | Card face. |
| `details` | `ReactNode` | — | Added in the open view. |
| `label` | `string` | — | Dialog name. |
| `width` | `number` | `560` | Open width in px. |
| `className` | `string` | — | Extra classes for the outer element. |

## Variants

- **Grid.** A grid of these, one open at a time.

## Accessibility

- A modal dialog: focus moves in, is held, and returns to the card; Escape and backdrop close it.

## Motion

- Shared layout animation; one element owns the layout at a time.
- Reduced motion: no travel.
