No.52 · Buttons· New
Type to Delete
A danger-zone card for the things you can't take lightly: the delete button stays off until you type the exact 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: Light
Build a danger-zone card for deleting a project ('atlas-web') where the delete button only turns on once the name is typed exactly. 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. Card: up to 30rem, 22px padding, 14px radius, a red-edged hairline. Heading 'Delete this project' (17px semibold), a muted sentence of consequences ('This removes atlas-web, its 14 deployments, every domain and all of its environment variables.'), a label 'Type atlas-web to confirm' with the name set as code, and a 40px mono input that gets a red edge and a soft red ring on focus. Right-aligned: a hairline 'Cancel' (clears the field) and a solid red 'Delete this project' with a bin icon that stays disabled until the text matches exactly, ignoring outer spaces. Enter submits. 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 name field; when the ring empties it reads 'atlas-web was deleted' in muted text. Every step is announced in one polite live region. The progress, done and undo states appear inside the card. 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): --tdlb-card #ffffff; --tdlb-edge #e3e3e3; --tdlb-field #ffffff; --tdlb-focus #2563eb; --tdlb-ink #171717; --tdlb-ok #15803d; --tdlb-red #dc2626; --tdlb-red-edge #fecaca; --tdlb-red-hover #b91c1c; --tdlb-red-ink #b91c1c; --tdlb-red-wash #fef2f2; --tdlb-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: Type the name; Enter or the button deletes; Cancel clears the field; Tab reaches Undo afterwards. Motion: The input's focus ring eases in over 0.15s and the done tick pops. Reduced motion removes the pop and the entrance. Accessibility: A labelled form and field with a described hint (the button turns on when the name matches exactly); disabled uses the native attribute; the undo pill states the seconds left; one polite status region announces each step. Responsive behavior: The card fills its container up to 30rem. Touch: Every control is a normal form control; 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
- Type the name; Enter or the button deletes; Cancel clears the field; Tab reaches Undo afterwards.
- Motion
- The input's focus ring eases in over 0.15s and the done tick pops. Reduced motion removes the pop and the entrance.
- Accessibility
- A labelled form and field with a described hint (the button turns on when the name matches exactly); disabled uses the native attribute; the undo pill states the seconds left; one polite status region announces each step.
- Responsive
- The card fills its container up to 30rem.
- On touch
- Every control is a normal form control; nothing depends on hover.