Flip Button
betaA button with a front and a back face that turns over in 3D on a spring — on hover and focus, or as a toggle on press.
- Forms
- 1 file
- 1 npm package
- Accessibility notes
pnpm dlx @dowel-ui/cli add flip-buttonnpm packages installed: class-variance-authority.
import { FlipButton } from "@/components/ui/flip-button";Default
Axes
Press Toggle
Surfaces
<FlipButton>
| Prop | Type | Default |
|---|---|---|
back (required)The face shown once turned over. Decorative: it is aria-hidden. | ReactNode | — |
axis | "y" | "x" | "y" |
backClassNameClasses for the back face. | string | — |
backVariantButton surface for the back face. Defaults to | FaceVariant | "secondary" |
defaultFlippedInitial turned-over state when uncontrolled ( | boolean | false |
flippedControlled turned-over state. Works with either trigger. | boolean | — |
frontThe face shown at rest. Names the button. Falls back to | ReactNode | — |
frontClassNameClasses for the front face. | string | — |
onFlippedChangeCalled with the new state when a press turns the button. | (flipped: boolean) => void | — |
shape | "default" | "pill" | "square" | "default" |
size | "sm" | "md" | "lg" | "icon" | "icon-sm" | "md" |
trigger | "hover" | "press" | "hover" |
variantButton surface for the front face. | FaceVariant | "primary" |
childrenThe front face, when | ReactNode | — |
Plus every attribute of <button> except children.
10/10
checks passed
- Tested — passes
- axe assertion — passes
- Keyboard tested — passes
- Storybook examples — passes
- Accessibility documented — passes
- Semantic tokens only — passes
- Motion from tokens — passes
- className merged — passes
- Visible focus — passes
- No fixed widths — passes