No.50 · Buttons· New
Danger Button
A destructive action that asks in place: the button opens into a short question with a safe Cancel and a red Delete, which gives up by itself after a few seconds. 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: Light
Build a button for deleting a project ('atlas-web') that asks for confirmation in place, with progress, a done state and an undo window. 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. Resting: 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 (a 0.22s wipe): '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 and its focus. The flow is a small state machine: idle → 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 control; when the ring empties it reads 'atlas-web was deleted' in muted text. Every step is announced in one polite live region. Show it centred on a #fafafa / #0a0a0a page; the demo resets 2.4s after the undo window closes. Selected variant — Light (light): Palette for this theme (Light): --dgr-card #ffffff; --dgr-edge #e3e3e3; --dgr-field #ffffff; --dgr-focus #2563eb; --dgr-ink #171717; --dgr-ok #15803d; --dgr-red #dc2626; --dgr-red-edge #fecaca; --dgr-red-hover #b91c1c; --dgr-red-ink #b91c1c; --dgr-red-wash #fef2f2; --dgr-soft #5f5f5f. Treat these as the root colour tokens, one value per role, and name them to suit your code. Select it with the theme option set to "light". Keep every dimension, spacing value, state and motion from the brief unchanged, and keep text at 4.5:1 contrast or better on these surfaces. 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: Escape cancels the question; Tab reaches Cancel, Delete and then Undo; Enter and Space press the focused button. Motion: The question opens with a 0.22s wipe and its 2px timer runs out over 6s; the done tick pops. Reduced motion removes the wipe, the pop and the entrance. Accessibility: Real buttons. The question is a labelled group that puts focus on the safe answer; the undo pill states the seconds left; one polite status region announces each step. Responsive behavior: The question stays on one line (its text hides under 30rem); the buttons never wrap. Touch: Every control is a normal button; nothing depends on hover. 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
- Escape cancels the question; Tab reaches Cancel, Delete and then Undo; Enter and Space press the focused button.
- Motion
- The question opens with a 0.22s wipe and its 2px timer runs out over 6s; the done tick pops. Reduced motion removes the wipe, the pop and the entrance.
- Accessibility
- Real buttons. The question is a labelled group that puts focus on the safe answer; the undo pill states the seconds left; one polite status region announces each step.
- Responsive
- The question stays on one line (its text hides under 30rem); the buttons never wrap.
- On touch
- Every control is a normal button; nothing depends on hover.