REFERENCE
- Gallery page: https://magpui.com/en/i/send-button-with-undo-countdown-c88655
- First frame (image): https://dnioievkvxejjbxgwvko.supabase.co/storage/v1/object/public/media/send-button-with-undo-countdown-c88655/shot.jpg
- Clip (mp4): https://dnioievkvxejjbxgwvko.supabase.co/storage/v1/object/public/media/send-button-with-undo-countdown-c88655/clip.mp4
- Original post: https://x.com/Dharmeesh_dev/status/2119495164653932555 by @Dharmeesh_dev
Before building, download the first frame and look at it. If ffmpeg is available, download the clip and extract frames (ffmpeg -i clip.mp4 -vf fps=2 frame-%02d.png), then study the motion frame by frame. Match what you see; the text below describes it, the frames are the truth.
BUILD: Build only a send button that expands into a sent confirmation with a five-second undo countdown. Keep it compact, calm and reversible.
DESIGN SYSTEM: Off-white #f6f7f2 surface; nearly black #181a19 control, white text, pale blue #b9d0ff Undo action. Idle circular control about 56px, expanded pill about 220px wide and 56px high, fully rounded ends. Use a 16px neutral sans-serif, a 20px upward arrow, a 20px countdown ring, thin divider and muted 14px helper text 24px below.
MOTION: On send, expand width 56 to 220px over 320ms with cubic-bezier(0.22,1,0.36,1); fade the arrow out over 100ms, then reveal ring, Sent label and Undo with 80ms delay and 180ms opacity transition. Animate SVG ring dash offset linearly over exactly 5000ms. On timeout or undo, fade inner contents for 100ms and collapse over 280ms with cubic-bezier(0.22,1,0.36,1). Use a brief muted green return state before restoring the idle dark button.
SECTIONS: Idle arrow and Press send helper; active Sent pill with decreasing ring, separator and Undo; timeout returns to idle; Undo cancels the pending operation and returns to idle.
IMPLEMENTATION: Use Motion layout or animated width and SVG stroke-dashoffset. Represent pending send, cancel and commit as explicit states; clear timers on cancellation and unmount, and do not simulate successful backend delivery. Keep focus visible; Enter or Space activates send and Undo is a separate button. Announce status once in an aria-live region, not every tick. For prefers-reduced-motion update width and content instantly; retain countdown information. Animate one control only.
ADAPT TO THE PROJECT: Reuse existing design tokens, components and fonts. Map these colors to the nearest project tokens. Never copy logos, brand names, photos or illustrations; use placeholders.
SUCCESS CHECK:
- Interaction works with pointer and keyboard without losing focus.
- Interrupted transitions keep their current visual position and settle correctly.
- Reduced motion removes movement while preserving every state and action.