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
| Prop | Type | Default | Description |
|---|---|---|---|
| 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. |
| googleClientId | string | β | Google OAuth client ID. Required to show the Google button. |
| title | string | "Sign in" | Form heading. |
| subtitle | string | "Welcome back." | Subheading below the title. |