Skip to content

No.51 · Buttons· New

Hold to Delete

No dialog: the button itself is the confirmation. A red fill grows across it while you hold it and drains if you let go, and only a full hold deletes. Then it shows the work, confirms it's done, and offers a few seconds to undo.

The prompt

Copy this text

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

Written for the variant you picked above: Light

Build a 'hold to delete' button for a project ('atlas-web'): the press itself is the confirmation. 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 button is 42px tall, at least 13.5rem wide, 10px radius, red text on the red wash with a red-edged hairline, a bin icon and 'Hold to delete project'. While pressed (pointer, or Space or Enter held) a solid red layer with white text is revealed from the left in step with the hold, filling in 1.2s, and the label reads 'Keep holding…'. Letting go drains it at twice the speed and shows 'Keep holding to confirm' under the button. A full fill confirms. Use pointer capture, no context menu, and no touch scrolling while held. With reduced motion the fill is simply on while held. 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): --hdlb-card #ffffff; --hdlb-edge #e3e3e3; --hdlb-field #ffffff; --hdlb-focus #2563eb; --hdlb-ink #171717; --hdlb-ok #15803d; --hdlb-red #dc2626; --hdlb-red-edge #fecaca; --hdlb-red-hover #b91c1c; --hdlb-red-ink #b91c1c; --hdlb-red-wash #fef2f2; --hdlb-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: Press and hold with a mouse, finger, or Space or Enter; release early to cancel; Tab reaches Undo afterwards. Motion: The fill follows your press frame by frame and drains at twice the speed; the done tick pops. Reduced motion turns the fill into a simple on/off and removes the pop. Accessibility: A native button with a described hint ('Keep holding to confirm'); keyboard holding works with Space or Enter; the undo pill states the seconds left; one polite status region announces each step. Responsive behavior: A fixed-height button that keeps its width; nothing wraps. Touch: Holding works with a finger (pointer capture, no context menu, no 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
Press and hold with a mouse, finger, or Space or Enter; release early to cancel; Tab reaches Undo afterwards.
Motion
The fill follows your press frame by frame and drains at twice the speed; the done tick pops. Reduced motion turns the fill into a simple on/off and removes the pop.
Accessibility
A native button with a described hint ('Keep holding to confirm'); keyboard holding works with Space or Enter; the undo pill states the seconds left; one polite status region announces each step.
Responsive
A fixed-height button that keeps its width; nothing wraps.
On touch
Holding works with a finger (pointer capture, no context menu, no scrolling while held).

Featured

425 components