@@ -16,7 +16,8 @@ export default function LoginPage() {
1616 return (
1717 <div style = { { display: ' flex' , minHeight: ' 100vh' , alignItems: ' center' , justifyContent: ' center' }} >
1818 <UrAuth
19- providers = { [' google' , ' github' ]}
19+ providers = { [' google' , ' github' ]}
20+ enableEmailPassword = { true }
2021 theme = " light"
2122 />
2223 </div >
@@ -28,12 +29,187 @@ export default function LoginPage() {
2829
2930| Prop | Type | Default | Description |
3031| ---| ---| ---| ---|
31- | ` theme ` | ` 'light' \| 'dark' ` | ` 'light' ` | The visual theme of the component. |
32- | ` providers ` | ` Array<'google' \| 'github'> ` | ` [] ` | Social auth providers to display. These must be enabled in your urBackend Dashboard first. |
32+ | ` theme ` | ` 'light' \| 'dark' ` | ` 'light' ` | Visual theme mode (` ThemeMode ` internally). |
33+ | ` providers ` | ` ('google' \| 'github')[] \| { google?: boolean; github?: boolean; emailPassword?: boolean } ` | ` ['google', 'github'] ` | Auth methods to show. Supports legacy array form and v0.2.0 object form. |
34+ | ` enableEmailPassword ` | ` boolean ` | ` true ` | Top-level shorthand to enable/disable email/password auth. |
35+ | ` colors ` | ` Partial<AuthColors> ` | ` undefined ` | Overrides for auth widget theme colors. |
36+ | ` branding ` | ` AuthBranding ` | ` undefined ` | Branding/white-label configuration (logo, app name, subtitle, brand color). |
37+ | ` labels ` | ` Partial<AuthLabels> ` | ` undefined ` | Text/copy overrides for tabs, titles, buttons, and footer prompts. |
38+ | ` onSuccess ` | ` () => void ` | ` undefined ` | Called after successful sign-in or sign-up flow. |
3339
34- ## Customizing the Design
40+ > All customization props are optional. If omitted, ` <UrAuth> ` falls back to the same default behavior/UI style as v0.1.x.
3541
36- The ` <UrAuth> ` component uses a modern, square design aesthetic (sharp corners). It adapts well to both light and dark backgrounds depending on the ` theme ` prop you provide.
42+ ## ` providers ` and ` enableEmailPassword `
43+
44+ ` providers ` now accepts either:
45+
46+ ``` ts
47+ (' google' | ' github' )[]
48+ ```
49+
50+ or:
51+
52+ ``` ts
53+ {
54+ google ?: boolean ;
55+ github ?: boolean ;
56+ emailPassword ?: boolean ;
57+ }
58+ ```
59+
60+ ### Example: Email/password only
61+
62+ ``` tsx
63+ <UrAuth
64+ providers = { { google: false , github: false , emailPassword: true }}
65+ />
66+ ```
67+
68+ ### Example: Google only
69+
70+ ``` tsx
71+ <UrAuth
72+ providers = { { google: true , github: false , emailPassword: false }}
73+ />
74+ ```
75+
76+ ### Example: Disable all methods
77+
78+ ``` tsx
79+ <UrAuth providers = { { google: false , github: false , emailPassword: false }} />
80+ ```
81+
82+ This renders the built-in ` No authentication methods are enabled for this screen. ` message.
83+
84+ ### ` enableEmailPassword ` interaction
85+
86+ - ` enableEmailPassword ` is a shorthand global toggle.
87+ - When ` providers ` is an object and includes ` emailPassword ` , that object value takes precedence.
88+ - If ` providers.emailPassword ` is omitted, ` enableEmailPassword ` is used.
89+
90+ ## ` colors ` theme customization
91+
92+ Use ` colors ` to override theme tokens:
93+
94+ ``` ts
95+ type AuthColors = {
96+ background: string ;
97+ surface: string ;
98+ text: string ;
99+ textMuted: string ;
100+ border: string ;
101+ inputBackground: string ;
102+ primary: string ;
103+ primaryColor? : string ; // alias for primary button color
104+ primaryText: string ;
105+ footerBackground: string ;
106+ dividerText: string ;
107+ socialButtonBackground: string ;
108+ };
109+ ```
110+
111+ Set a custom brand color on the primary sign-in button:
112+
113+ ``` tsx
114+ <UrAuth colors = { { primaryColor: ' #6366f1' }} />
115+ ```
116+
117+ If both ` colors.primaryColor ` and ` branding.primaryColor ` are provided, ` branding.primaryColor ` takes precedence.
118+
119+ ## ` branding ` white-label options
120+
121+ ``` ts
122+ type AuthBranding = {
123+ brandName? : string ;
124+ appName? : string ;
125+ title? : string ;
126+ subtitle? : string ;
127+ logo? : React .ReactNode | string ; // URL string or custom React node
128+ logoUrl? : string ; // URL alias
129+ primaryColor? : string ;
130+ };
131+ ```
132+
133+ Example:
134+
135+ ``` tsx
136+ <UrAuth
137+ branding = { {
138+ appName: ' Acme' ,
139+ logoUrl: ' https://acme.com/logo.png' ,
140+ subtitle: ' Secure access for your team' ,
141+ }}
142+ />
143+ ```
144+
145+ ## ` labels ` text overrides (with aliases)
146+
147+ Supported label keys:
148+
149+ - Tabs: ` loginTab ` (` signInTab ` alias), ` signupTab ` (` signUpTab ` alias)
150+ - Titles: ` loginTitle ` (` signInTitle ` alias), ` signupTitle ` (` signUpTitle ` alias), ` forgotTitle ` , ` resetTitle ` , ` forgotSubtitle ` , ` resetSubtitle `
151+ - Buttons: ` loginButton ` (` signInButton ` alias), ` signupButton ` (` signUpButton ` alias), ` forgotButton ` , ` resetButton ` , ` googleButton ` , ` githubButton `
152+ - Field labels/placeholders: ` emailLabel ` , ` emailPlaceholder ` , ` passwordLabel ` , ` passwordPlaceholder ` , ` nameLabel ` , ` namePlaceholder ` , ` otpLabel ` , ` otpPlaceholder `
153+ - Footer/misc: ` forgotPasswordLink ` , ` socialDivider ` , ` footerSigninPrompt ` , ` footerSignupPrompt ` , ` footerForgotPrompt ` , ` noAuthMethods `
154+
155+ Example:
156+
157+ ``` tsx
158+ <UrAuth
159+ labels = { {
160+ signInTitle: ' Welcome back to Acme' ,
161+ signInButton: ' Continue' ,
162+ footerSigninPrompt: ' Need an account?' ,
163+ }}
164+ />
165+ ```
166+
167+ ## Full v0.2.0 customization example
168+
169+ ``` tsx
170+ import { UrAuth , GuestRoute } from ' @urbackend/react' ;
171+
172+ export default function LoginPage() {
173+ return (
174+ <GuestRoute fallback = { <div >Loading...</div >} onRedirect = { () => (window .location .href = ' /dashboard' )} >
175+ <UrAuth
176+ providers = { {
177+ github: true ,
178+ google: true ,
179+ emailPassword: true ,
180+ }}
181+ enableEmailPassword = { true }
182+ theme = " light"
183+ colors = { {
184+ primaryColor: ' #4F46E5' ,
185+ socialButtonBackground: ' #ffffff' ,
186+ }}
187+ branding = { {
188+ appName: ' My Custom App' ,
189+ logoUrl: ' https://vite.dev/logo.svg' ,
190+ subtitle: ' Secure authentication' ,
191+ primaryColor: ' #4F46E5' ,
192+ }}
193+ labels = { {
194+ signInTitle: ' Welcome back to Custom App' ,
195+ signInButton: ' Proceed to App' ,
196+ signUpButton: ' Create your account' ,
197+ }}
198+ onSuccess = { () => {
199+ // route after successful auth
200+ window .location .href = ' /dashboard' ;
201+ }}
202+ />
203+ </GuestRoute >
204+ );
205+ }
206+ ```
207+
208+ ## Migration (v0.1.x → v0.2.0)
209+
210+ - ` providers ` now also accepts object form: ` { google?, github?, emailPassword? } `
211+ - Existing array usage (` ['google', 'github'] ` ) still works
212+ - No breaking API changes otherwise
37213
38214## Behavior
39215
0 commit comments