Default
Click it, or Tab to it and press Space. The card lifts off the desk as it turns.
An index card with two sides. It turns over in 3D when you click it or press Space, lifting off the desk on the way; the side you cannot see is inert and hidden from assistive technology. For flashcards, reveals, and anything with a back.
npx shadcn@latest add @wobko/flip-card第一次使用?先把 registry 加进 components.json。 如何安装
Click it, or Tab to it and press Space. The card lifts off the desk as it turns.
axis="x" turns it like a page of a top-bound pad. Any paper works for either face.
A real use: a controlled flip card as a study deck. Turning is the answer; Next shows the front of the following card.
trigger={false} leaves the card free of the overlay, so a face can hold real buttons. The flip button is your own.
The root: a perspective box holding the two faces in one grid cell (so it is as big as the bigger face) and, by default, a trigger button over the whole card. Size it with className (default h-48 w-72).
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| flipped / defaultFlipped / onFlippedChange | boolean / boolean / (flipped: boolean) => void | - | Controlled or uncontrolled: true shows the back. |
| axis | "y" | "x" | "y" | Turn like a page (y) or like a notepad (x). |
| trigger | boolean | true | Lay a button over the whole card. Turn it off when the faces hold links or buttons, and compose your own FlipCardTrigger. |
| label | string | "Flip card" | Accessible name of the default trigger. |
The button that turns the card, with aria-pressed. The default overlay carries a curled arrow in the corner that darkens on hover and a drawn focus ring round the card.
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| asChild | boolean | - | Use your own element (a Button) as the trigger. |
| overlay | boolean | true | Cover the whole card. Off: it is an ordinary button placed by you. |
| hint | boolean | - | The corner arrow; default on for the overlay. |
CLI 会复制进你项目的文件。
正在加载源码