Genesis
@beta

AuthForm

The web sign-in form. See the file's header. ```tsx const client = createAuthFormClient(supabase, { url, publishableKey, redirectTo: `${origin}/auth/callback` }); <AuthPage branding={{ headline: messages.auth.titles[mode] }}> <AuthForm client={client} mode={mode} onModeChange={setMode} methods={["password", "email-code"]} onSuccess={() => navigate("/")} /> </AuthPage> ```

packages/ui/src/components/patterns/auth-form.tsx

Import
Subpath export: @marktiderman/genesis-ui/patterns
import { AuthForm } from "@marktiderman/genesis-ui/patterns";
Components
Auto-generated from TypeScript source via react-docgen-typescript.

AuthForm

The web sign-in form. See the file's header. ```tsx const client = createAuthFormClient(supabase, { url, publishableKey, redirectTo: `${origin}/auth/callback` }); <AuthPage branding={{ headline: messages.auth.titles[mode] }}> <AuthForm client={client} mode={mode} onModeChange={setMode} methods={["password", "email-code"]} onSuccess={() => navigate("/")} /> </AuthPage> ```

PropTypeDefaultDescription
client*AuthFormClient—Every call goes through it.
allowPasswordResetbooleantrueOffer "Forgot password?" with the password method. Default true.
allowSignUpbooleantrueOffer "Create one", and let a magic link or code make an account. Default true.
classNamestring—
codeLengthnumber6Digits in an emailed code. Default 6 (Supabase's default). It must match the project's `otp_length` (Auth settings, "Email OTP length"): the code field takes exactly this many digits, so with a mismatch no code can ever be entered whole and code sign-in fails with nothing to say why. `/auth/v1/settings` doesn't report `otp_length`, so the form can't check it.
defaultModeenumsign-inThe first mode, uncontrolled. Default `"sign-in"`.
initialEmailstringInitial email ("sign in as …" links). In `mode="new-password"`, the account's email, when the client can't say (`currentEmail`).
methodsreadonly AuthSignInMethod[]["password"]How to sign in, in order: the first is shown, the rest are links under the form. Default `["password"]`.
minPasswordLengthnumber8For a new password. Default 8. Supabase Auth still applies its own rules.
modeenum—The mode, controlled. Pair with `onModeChange` (a route per mode, say).
noticestring | AuthFormNotice | null—A notice above the form, on its first step: why the person is here again ("your reset link has expired", "sign-in was cancelled", "your account is deleted"). A string is a message on its own. Read it from the URL the callback sent them to, say.
offerCodeOnConfirmbooleanfalseOpt-in: on the "check your email" screens after a magic link and after sign-up, offer "Enter the code instead", which opens the code step for the same email. For someone signing in from an embedded browser (an in-app web view), where the link opens in another browser and they would be stuck. Needs `"email-code"` in `methods` and `{{ .Token }}` in the project's Magic Link and Confirm signup email templates. Default false.
onModeChange((mode: AuthFormMode) => void)—The form's links ("Create one", "Forgot password?", "Back to sign in") ask for a mode.
onSuccess((result: AuthFormSuccess) => void)—Signed in, signed up with a session, or a new password saved. Navigate from here.
providersfalse | readonly (string | AuthFormProvider)[]—Provider buttons. Ids or objects; `false` for none. Left out, the form asks `client.providers()` (with Supabase: the providers turned on in the project).
resendCooldownnumber60Seconds before a code can be sent again. Default 60 (Supabase's default rate limit).
showAccountEmailbooleanfalseOpt-in: in `mode="new-password"`, show the account's email read-only above the new password. Without it the email (when known, from `initialEmail` or `client.currentEmail()`) is still in the form, hidden, with `autocomplete="username"`, so a password manager saves the pair. Default false.
signUpFieldsreadonly AuthFormSignUpFieldSpec[] | ((slot: AuthFormSignUpFieldsSlot) => ReactNode)—Opt-in: more fields on the sign-up form, above the email, whose values go to `client.signUp` as `data` (with Supabase, `options.data`: the user's metadata, which an app's signup trigger reads as `full_name`, say). Named fields (`["full_name"]`, or your own), or a slot that draws its own inputs and sets the values. Default none, and `signUp` gets no `data`.
testIDstringauth-formDefault `"auth-form"`; parts use `${testID}-email`, `-phone`, `-password`, `-submit`, `-error`, `-status`, `-notice`, `-code`, `-resend`, `-enter-code`, `-provider-<id>`, `-field-<name>`, `-account-email`.

AUTH_PROVIDER_NAMES

Brand names for provider ids Supabase Auth knows. Not translated.

No declared props.

Storybook
Storybook hosts the canonical visual reference with controls for every variant.