Component

LoginForm

Combined sign-in and registration form supporting Google OAuth and email/password. Handles its own loading and error states internally.

Usage

live editor β€” edit to update preview
<LoginForm
  onGoogleLogin={async (idToken) => {
    await signInWithGoogle(idToken);
  }}
  onEmailLogin={async (email, password) => {
    await signInWithEmail(email, password);
  }}
  onRegister={async (name, email, password) => {
    await createAccount(name, email, password);
  }}
  onSuccess={(method) => {
    router.push("/dashboard");
  }}
/>

Props

PropTypeDefaultDescription
onGoogleLogin*(idToken: string) => Promise<void>β€”Called with the Google ID token when the user completes Google sign-in.
onEmailLogin*(email: string, password: string) => Promise<void>β€”Called with credentials on email sign-in submit.
onRegister*(name: string, email: string, password: string) => Promise<void>β€”Called when the user submits the registration form.
onSuccess*(method: SignInMethod) => void | Promise<void>β€”Called after any successful auth. Redirect here.
googleClientIdstringβ€”Google OAuth client ID. Required to show the Google button.
titlestring"Sign in"Form heading.
subtitlestring"Welcome back."Subheading below the title.