docs: fix onSubmit optionality in login dialog spec
Make onSubmit optional so the social-only variant works cleanly without requiring a no-op callback. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -21,7 +21,7 @@ interface LoginFormProps {
|
|||||||
logo?: ReactNode
|
logo?: ReactNode
|
||||||
title?: string // Default: "Sign in"
|
title?: string // Default: "Sign in"
|
||||||
socialProviders?: SocialProvider[] // Omit or [] to hide social section + divider
|
socialProviders?: SocialProvider[] // Omit or [] to hide social section + divider
|
||||||
onSubmit: (credentials: { email: string; password: string; remember: boolean }) => void
|
onSubmit?: (credentials: { email: string; password: string; remember: boolean }) => void // Omit to hide credentials section
|
||||||
onForgotPassword?: () => void // Omit to hide link
|
onForgotPassword?: () => void // Omit to hide link
|
||||||
onSignUp?: () => void // Omit to hide "Don't have an account?"
|
onSignUp?: () => void // Omit to hide "Don't have an account?"
|
||||||
error?: string // Server-side error, rendered as Alert
|
error?: string // Server-side error, rendered as Alert
|
||||||
@@ -62,9 +62,9 @@ Social-first ordering, top to bottom:
|
|||||||
|
|
||||||
The form adapts automatically based on props:
|
The form adapts automatically based on props:
|
||||||
|
|
||||||
- **Full** — social providers + credentials + all links
|
- **Full** — `socialProviders` + `onSubmit` both provided. Social buttons, divider, and credentials all shown.
|
||||||
- **Credentials only** — no `socialProviders` passed, social section and divider hidden
|
- **Credentials only** — `onSubmit` provided, no `socialProviders`. Social section and divider hidden.
|
||||||
- **Social only** — only `socialProviders` passed, credentials section hidden (make `onSubmit` optional for this case, or accept it will never fire)
|
- **Social only** — `socialProviders` provided, `onSubmit` omitted. Credentials section (email, password, remember me, submit button) and divider hidden.
|
||||||
|
|
||||||
## Validation
|
## Validation
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user