Skip to content

No.22 · Buttons

Foldaway

Two sheets of card meeting at a crease: on hover the top sheet folds down over the front and its back reveals the next state.

The prompt

Copy this text

Automatic copying is unavailable. Copy the selected text using your device’s copy command.

The design brief behind this component — reuse it to regenerate, remix, or explain it.

Design a button that behaves like a folded piece of card. It is a 192×56px sheet of warm paper with a crease at its horizontal midline and a soft grounded shadow. At rest the label ("Send message") reads across both halves. On hover or focus the top half — a flap hinged on the crease — folds forward and down through 180° over 650ms (cubic-bezier(0.5,0,0.15,1)) in real 3D perspective. Because the flap has two faces, the fold reveals new text: the flap's front is the top half of the resting label; its back (visible once folded) is the bottom half of the revealed label, and underneath, the top half of the revealed label appears in the space the flap vacated. The result is that the whole label changes from "Send message" to "Sent ✓" through a physical fold, in a cool frost tint so the state change is unmistakable. As the flap turns away it darkens with a gradient shading, and a hairline crease shadow stays at the hinge. Keyboard focus folds it too; on touch it folds while pressed. The accessible name is the resting label (visually hidden copy) — the decorative halves are aria-hidden. Implementation requirements: Use React and TypeScript. Keep the component self-contained, with uniquely scoped CSS and no animation libraries. Include required imports, styles and font setup in the result. Interaction: Hover/focus folds the flap and swaps the label; leaving unfolds it. On touch it folds while pressed. Motion: Fold 650ms cubic-bezier(0.5,0,0.15,1) in 3D; shading fades over the same time. Accessibility: A real <button> with a visually-hidden resting label; the revealed text is decorative, so if it conveys real state, also announce it via aria-live in your app. Focus-visible triggers the same fold plus an outline. Responsive behavior: Fixed 12rem width by default; override with a class for longer labels. Touch: Folds while pressed. Preserve keyboard access, visible focus and reduced-motion behavior. Keep fictional demo data and simulated service calls in a separate usage example; expose callbacks for real actions and recover from rejected requests. Keep usage-example links inside the demo: use local buttons or prevent navigation. Demonstration links must not navigate to Vitrine routes or open other pages; preserve real URL support in the reusable component itself. Verify the result at narrow and wide viewport sizes, with keyboard input and reduced motion enabled.

Notes

Interaction
Hover/focus folds the flap and swaps the label; leaving unfolds it. On touch it folds while pressed.
Motion
Fold 650ms cubic-bezier(0.5,0,0.15,1) in 3D; shading fades over the same time.
Accessibility
A real <button> with a visually-hidden resting label; the revealed text is decorative, so if it conveys real state, also announce it via aria-live in your app. Focus-visible triggers the same fold plus an outline.
Responsive
Fixed 12rem width by default; override with a class for longer labels.
On touch
Folds while pressed.