REFERENCE
- Gallery page: https://magpui.com/en/i/code-input-that-becomes-status-bce7a3
- First frame (image): https://dnioievkvxejjbxgwvko.supabase.co/storage/v1/object/public/media/code-input-that-becomes-status-bce7a3/shot.jpg
- Clip (mp4): https://dnioievkvxejjbxgwvko.supabase.co/storage/v1/object/public/media/code-input-that-becomes-status-bce7a3/clip.mp4
- Original post: https://x.com/sucodeee/status/2122645442437820904 by @sucodeee
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 a six-digit verification-code input that smoothly contracts into a compact status pill. Focus, invalid-code feedback, verifying and the compact Enter code state should feel like one continuous control. Limit the scope to this single interaction.
DESIGN SYSTEM: Use an off-white #F8F7F3 surrounding surface. Expanded control approximately 300 by 52px with a fully rounded white rim, subtle inset shading and a diffuse shadow below. Six 40px light-gray #EEEDE8 rounded slots, 5px gaps and 5px padding. Digits use dark #252522 medium-weight sans-serif around 20px. Focus is a thin near-black rounded outline and caret. Invalid slots receive a pale #FBE2E3 tint and muted red #DC626C digits. Compact pill is roughly 142 by 48px, with a small leading spinner or lock and a 14px label.
MOTION: Estimate timing from the reference: digit entry fades and rises 4px over 150ms with cubic-bezier(0.22,1,0.36,1); focus outline tracks the active slot over 180ms. Invalid completion tints the six cells together over 180ms, then allows correction; do not add an unobserved large shake. On valid completion, replace the slots with a spinner and Verifying label, shrinking the shared rounded container to pill width over 400ms with cubic-bezier(0.22,1,0.36,1). Crossfade content over 160ms without exposing overlapping text. The compact idle state shows a lock and Enter code; activating it restores the input. These timings are implementation estimates.
SECTIONS: Empty focused first cell; progressive entry with focus advancing; complete invalid code in soft red; corrected partial code; compact Verifying state; compact Enter code state. Keep verification outcome supplied by the host application rather than inventing a visible success state.
IMPLEMENTATION: React plus Motion layout animation for the shared container and keyed content crossfades. Use one real text input with inputmode numeric and autocomplete one-time-code; render the six visual cells from its value. Support paste, deletion, arrow keys and proper focus; associate a label and error text, announce status politely. Demo verification must be simulated locally and never collect real secrets or trigger real authentication. Respect prefers-reduced-motion with instant resizing and static status text. Avoid layout animation on every caret blink and prevent double submit.
ADAPT TO THE PROJECT: Reuse existing fonts, tokens and form primitives. Map estimated colors to project tokens. Never copy source logos, brand names or illustrations; no external assets are required.
SUCCESS CHECK:
- Six digits can be typed, pasted and edited with keyboard-only access.
- Invalid, verifying and compact states preserve a single rounded control without clipping.
- Reduced-motion mode and narrow viewports remain clear and accessible.