Auth Form

A sign-in / sign-up form that reveals the password field progressively, morphs between modes, and ticks password requirements live.

Open in v0

Last updated: August 13, 2026

Installation

npx smoothui-cli add auth-form

Scope

AuthForm is presentation only. It never authenticates, never stores or transmits credentials, and never makes a network call. It renders whatever status, error, and fieldErrors you pass in, and calls your onSubmit with the current { email, password } values — everything else (validation, API calls, sessions) is your responsibility to wire up.

Features

  • Email field shown first; the password field springs into place with a measured-height animation once the email looks valid — no field ever mounts on a keystroke, so autofill works
  • mode="sign-in" | "sign-up" cross-fades the header with a direction-aware slide and morphs the submit button label
  • Password requirement list ticks live as you type, using your own test functions or the built-in defaults
  • Submit button morphs through idle → submitting (spinner) → success (checkmark)
  • Optional OAuth-style provider buttons and a "send a magic link instead" action
  • Show/hide password toggle with aria-pressed
  • Composes Smooth Button for the provider, submit, reveal and magic-link controls — the submit spinner is the primitive's own loading state
  • Field-level and form-level error rendering, with the error summary auto-focused on failed submit

Accessibility

Keyboard Interactions

KeyDescription
Tab / Shift+TabMoves through email, password, show/hide toggle, and submit in document order
EnterSubmits the form from any field
Typing in emailReveals the password field once the value matches a valid email shape — no key handler required

ARIA Attributes

AttributeElementPurpose
<label htmlFor>Email, passwordBinds every input to its visible label
aria-invalidEmail, password inputsMarks a field as failing validation
aria-describedbyEmail, password inputsPoints to the field's error message and/or the requirements list
role="alert"Error summary, field errorsAnnounces validation failures immediately
tabIndex={-1} + focus on errorError summaryMoves focus to the failure so screen reader users hear it right away
aria-pressedShow/hide password buttonReflects whether the password is currently visible
aria-live="polite" + role="status"Status announcerAnnounces submitting / success / error state changes
tabIndex={-1} + aria-hiddenCollapsed password wrapperKeeps the hidden password field out of the tab order until the email is valid, without unmounting it

Screen Reader

  • The password field stays mounted at all times (never conditionally rendered) so autofill and password managers work; it is only removed from the tab order and hidden via aria-hidden while collapsed.
  • Each password requirement announces its label plus "met" or "not met" as you type.
  • The error summary receives focus automatically when status becomes "error" with a message.

Reduced Motion

This component respects the prefers-reduced-motion media query via useReducedMotion from Motion. When reduced motion is preferred, the password reveal skips the height animation (it snaps between 0 and auto), the mode-switch slide becomes an instant cross-fade, and the submit button label swap has no motion — all with duration: 0.

Props

AuthFormValues

AuthFormFieldErrors

AuthProvider

AuthPasswordRequirement

Created by

Powered by

lucide.dev
motion.dev

© 2026 SmoothUI. Built by Eduardo Calvo.