# <flip-card>

A two-sided card that flips on a tap or a command: the first child is the front, the second the back.

Category: Display.

```ham
<column style="gap-12 w-full">
    <flip-card id="card"
               flip-direction="up"
               flip-speed="400">
        <card style="p-24 w-full">
            <text style="muted text-sm">Spanish</text>
            <text style="text-2xl font-bold">la mariposa</text>
        </card>
        <card style="p-24 w-full bg-indigo-900">
            <text style="text-2xl font-bold text-white">the butterfly</text>
        </card>
    </flip-card>
    <button variant="filled"
            action="#card.flip">Flip</button>
</column>
```

How Hype Apps draws it on a phone: [light](https://hypeapps.dev/img/tags/flip-card-light.webp), [dark](https://hypeapps.dev/img/tags/flip-card-dark.webp).

## Attributes

| Name | What it does | Default |
|---|---|---|
| `flip-anchor` | Pivot; a face child can override for its own side. (center, left, right, top, bottom) | `center` |
| `flip-axis` | Explicit axis for custom hinge geometry (y-0, x-50). |  |
| `flip-delay` | ms to wait before a commanded flip runs (stagger a grid of cards). |  |
| `flip-depth` | 3D perspective depth | `800` |
| `flip-direction` | Direction: left, right, up, down, or degrees (0-360) | `left` |
| `flip-mode` | Rendering mode (flat, 3d) | `flat` |
| `flip-on` | Trigger: tap or none (media command only) (tap, none) | `tap` |
| `flip-speed` | Flip animation duration in ms | `600` |
| `flip-translate-x` | Hinge translation on x. |  |
| `flip-translate-y` | Hinge translation on y. |  |
| `id` | ID for media commands (#id.flip, #id.toggle) |  |

## Commands

| Name | What it does |
|---|---|
| `flip` | Flip, optionally in a direction. |
| `reset` | Back to the front (3d mode). |

## Readings

| Name | What it does |
|---|---|
| `swipe_angle` | With flip-on="swipe": the swipe's angle in degrees. |
| `swipe_dx` | The swipe's horizontal distance. |
| `swipe_dy` | The swipe's vertical distance. |
| `swipe_speed` | The swipe's speed. |

Any tag also takes gestures: `@on.tap`, `@on.longpress`, `@on.doubletap` and `@on.swipeleft` (and right, up and down). `@click` runs on a tap too.

## Guides and recipes that use it

- [Gestures](https://hypeapps.dev/docs/guides/gestures.md)

## Related tags

- [`<column>`](https://hypeapps.dev/docs/reference/column.md): Stacks its children top to bottom, with a gap between them and an alignment across.
- [`<card>`](https://hypeapps.dev/docs/reference/card.md): A surface for grouped content, with padding, rounded corners and a soft shadow.
- [`<text>`](https://hypeapps.dev/docs/reference/text.md): A run of text; with @text it shows an expression that updates as its variables change.
- [`<button>`](https://hypeapps.dev/docs/reference/button.md): A tappable button that runs an action: a fetch, a navigation or a statement.
- [`<ad>`](https://hypeapps.dev/docs/reference/ad.md): An ad slot in the page, filled with a banner from AdMob in a built app.
- [`<avatar>`](https://hypeapps.dev/docs/reference/avatar.md): A round avatar from a photo, initials or an icon, in any size and color.
- [`<badge>`](https://hypeapps.dev/docs/reference/badge.md): A small count or dot pinned to the corner of an icon or any other element.
- [`<canvas-tool>`](https://hypeapps.dev/docs/reference/canvas-tool.md): A drawing tool written in HAM and loaded into a draw pad as a plugin: touch handlers, state and options.

All tags: https://hypeapps.dev/docs/reference.md · The full reference: https://hypeapps.dev/llms.txt
