No.49 · Buttons· New
Danger Button
A destructive action with the right amount of friction: it asks in place with Cancel and Delete, or fills while you hold it, or waits for you to type the name. Then it shows the work, confirms it's done, and offers a few seconds to undo.
The prompt
Written for the variant you picked above: Inline confirm
Build a button for deleting a project ('atlas-web'), with confirmation, progress, a done state and an undo window, in the one confirmation style selected below. Inter at 500, 15px. Palette (light / dark): ink #171717 / #ededed, muted #5f5f5f / #a1a1a1, card #ffffff / #111111, hairline #e3e3e3 / #2a2a2a, red #dc2626 / #e5484d (hover #b91c1c / #f2555a), red wash #fef2f2 / #2a1215, red edge #fecaca / #5c1f24, red text #b91c1c / #ff6369, done green #15803d / #3fb950. Focus rings 2px #2563eb / #6ea8fe. The flow as a small state machine: idle → (asked) → working → done → gone. Working shows a 16px red spinner and 'Deleting atlas-web…' for at least 0.9s and until the real work settles. Done shows a green tick that pops in (scale from 0.4 with a slight overshoot), 'Deleted atlas-web' and an 'Undo' pill whose 18px ring drains over 5s; focus moves to Undo. Undo restores and returns focus to the start button; when the ring empties it reads 'atlas-web was deleted' in muted text. Every step is announced in one polite live region. Show it on a #fafafa panel and a #0a0a0a panel side by side; the demo resets 2.4s after the undo window closes. Selected variant — Inline confirm (inline): Inline confirm: the resting button is a quiet red-outlined pill (42px tall, 10px radius, red wash fill, red text, a bin icon, 'Delete project') that fills solid red with white text on hover. Pressing it opens, in the same spot, a card-coloured box with a red edge and a soft shadow: 'Delete atlas-web?', a hairline 'Cancel' and a solid red 'Delete' (both 32px). Focus goes to Cancel. A 2px red line along its bottom runs out over 6s and then the question cancels itself; pointing at the box holds the timer. Escape or Cancel returns to the button. This selection takes precedence over references to other themes or options in the general brief. Implement this selected appearance; do not add a variant picker or alternative appearances unless requested. 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: Keyboard works throughout: Escape cancels the question, Space or Enter can be held to confirm, Enter submits the typed name, Tab reaches Undo. Motion: The question opens with a 0.22s wipe, its 2px timer runs out over 6s, the hold fill follows your press frame by frame and drains at twice the speed, the done tick pops. Reduced motion removes the wipe and pop and turns the hold fill into a simple on/off. Accessibility: Real buttons and a labelled form. The question is a labelled group and puts focus on Cancel; the undo pill states the seconds left; the hold button has a described hint ('Keep holding to confirm'); one polite status region announces each step. Responsive behavior: Inline forms stay one line (the question text hides under 30rem); the card fills up to 30rem; the two panels stack on narrow screens. Touch: Holding works with a finger (pointer capture, no context menu or scrolling while held). 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
- Keyboard works throughout: Escape cancels the question, Space or Enter can be held to confirm, Enter submits the typed name, Tab reaches Undo.
- Motion
- The question opens with a 0.22s wipe, its 2px timer runs out over 6s, the hold fill follows your press frame by frame and drains at twice the speed, the done tick pops. Reduced motion removes the wipe and pop and turns the hold fill into a simple on/off.
- Accessibility
- Real buttons and a labelled form. The question is a labelled group and puts focus on Cancel; the undo pill states the seconds left; the hold button has a described hint ('Keep holding to confirm'); one polite status region announces each step.
- Responsive
- Inline forms stay one line (the question text hides under 30rem); the card fills up to 30rem; the two panels stack on narrow screens.
- On touch
- Holding works with a finger (pointer capture, no context menu or scrolling while held).