Skip to content

No.381 · Authentication

One-Field Sign-in

Email, code, signed in — all inside one field. The field changes width and contents between steps, labels hand off, and a hairline along its base shows how far along you are.

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: Night

Build a passwordless sign-in where the whole flow happens inside one field. A 68px-tall rounded field (16px radius, surface + hairline ring, accent focus ring) holds three stacked layers; only one is 'on' at a time. Layers cross-fade and slide 14px (out 300ms, in 360ms after a 140ms delay) and each step has its own small mono label in the top-left that lifts away as the next settles in. 1. Email: an email input and a square ink 'go' button; submitting validates, shows a spinner in the button ('sending'), then moves on. 2. Code: the field narrows (width eases over 620ms) and shows six slots (grouped 3+3) under a label 'Code sent to h••••@domain' — a single transparent one-time-code input sits over the slots; typed digits drop in, the caret blinks in the next slot, six digits auto-submit and the slots pulse in sequence while checking. A wrong code shakes the field, turns the progress rule rose and clears the slots. 'Change' goes back. 3. Done: the field narrows again into a full pill containing an initial avatar, the email, and a check that draws in. A 2px hairline along the field's bottom edge is the progress bar (12% → 40% → 62% → 86% → 100%, 760ms), fading out once signed in. Headline and helper text update per step. Ship a night theme and a warm paper theme. Require sendCode(email) and verify(code, email) callbacks. Await delivery before opening the code step. Catch delivery and verification failures, announce them, restore focus and allow retry. Prevent duplicate requests. The demo alone simulates delivery and verification; no real email is sent by the demo. Selected variant — Night (night): Apply the night theme. Where the brief above gives no colour values for it, choose a restrained night palette with text at 4.5:1 contrast or better. Keep the geometry, states and motion described above unchanged. 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 an email and press Enter/→; type or paste the six-digit code (auto-submits); 'Change' returns to the email step. Motion: 620ms field width/radius morph; layered cross-fade with 140ms hand-off; 760ms progress hairline; digit drop, sequential pulse while checking, shake on error, check draw on success. Accessibility: Real labelled inputs (email with autocomplete=email, code with autocomplete=one-time-code and inputMode numeric); aria-invalid + a polite status line for sending/checking/errors/success; focus moves to the right input each step. Reduced motion keeps the states but makes the transitions instant. Responsive behavior: Fluid up to 26rem; every width is min(100%, …) so it works at 320px. Touch: The numeric keypad opens for the code and SMS/email autofill works through one-time-code. 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 an email and press Enter/→; type or paste the six-digit code (auto-submits); 'Change' returns to the email step.
Motion
620ms field width/radius morph; layered cross-fade with 140ms hand-off; 760ms progress hairline; digit drop, sequential pulse while checking, shake on error, check draw on success.
Accessibility
Real labelled inputs (email with autocomplete=email, code with autocomplete=one-time-code and inputMode numeric); aria-invalid + a polite status line for sending/checking/errors/success; focus moves to the right input each step. Reduced motion keeps the states but makes the transitions instant.
Responsive
Fluid up to 26rem; every width is min(100%, …) so it works at 320px.
On touch
The numeric keypad opens for the code and SMS/email autofill works through one-time-code.