# Flip Card

> Two faces that turn over in 3D.

A toggle button with click, or turns while hovered or focused. For flashcards, pricing details and bios.

- 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/flip-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 flip-card
```

It installs to `components/galactrex/flip-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 { FlipCard } from "@/components/galactrex/flip-card";

<FlipCard front={<p>Q</p>} back={<p>A</p>} className="h-48 w-72" />
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `front / back` | `ReactNode` | — | Faces. |
| `trigger` | `"click" \| "hover"` | `"click"` | What flips it. |
| `axis` | `"y" \| "x"` | `"y"` | Turn axis. |
| `label` | `string` | — | Flip action name. |
| `className` | `string` | — | Extra classes for the outer element. |

## Variants

- **Flashcard.** Question on front, answer on back.

## Accessibility

- Click mode is a toggle button (aria-pressed); the hidden face is aria-hidden.

## Motion

- Spring rotation with hidden backfaces.
- Reduced motion: a cross-fade.
