<flip-card>
A two-sided card that flips on a tap or a command: the first child is the front, the second the back.
<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>
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). string |
|
flip-delay |
ms to wait before a commanded flip runs (stagger a grid of cards). number |
|
flip-depth |
3D perspective depth number |
800 |
flip-direction |
Direction: left, right, up, down, or degrees (0-360) string |
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 number |
600 |
flip-translate-x |
Hinge translation on x. number |
|
flip-translate-y |
Hinge translation on y. number |
|
id |
ID for media commands (#id.flip, #id.toggle) string |
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.