@@ -16,48 +16,59 @@ Equivalent FirebaseUI libraries are available for [iOS](https://github.com/fireb
1616
1717## Table of Contents
1818
19+ ### Getting Started
19201 . [ Demo] ( #demo )
20- 1 . [ Setup] ( #setup )
21- 1 . [ Prerequisites] ( #prerequisites )
22- 1 . [ Installation] ( #installation )
23- 1 . [ Provider Configuration] ( #provider-configuration )
24- 1 . [ Quick Start] ( #quick-start )
25- 1 . [ Minimal Example] ( #minimal-example )
26- 1 . [ Check Authentication State] ( #check-authentication-state )
27- 1 . [ Core Concepts] ( #core-concepts )
28- 1 . [ FirebaseAuthUI] ( #firebaseauthui )
29- 1 . [ AuthUIConfiguration] ( #authuiconfiguration )
30- 1 . [ AuthFlowController] ( #authflowcontroller )
31- 1 . [ AuthState] ( #authstate )
32- 1 . [ Authentication Methods] ( #authentication-methods )
33- 1 . [ Email & Password] ( #email--password )
34- 1 . [ Phone Number] ( #phone-number )
35- 1 . [ Google Sign-In] ( #google-sign-in )
36- 1 . [ Facebook Login] ( #facebook-login )
37- 1 . [ Other OAuth Providers] ( #other-oauth-providers )
38- 1 . [ Anonymous Authentication] ( #anonymous-authentication )
39- 1 . [ Custom OAuth Provider] ( #custom-oauth-provider )
40- 1 . [ Usage Patterns] ( #usage-patterns )
41- 1 . [ High-Level API (Recommended)] ( #high-level-api-recommended )
42- 1 . [ Low-Level API (Advanced)] ( #low-level-api-advanced )
43- 1 . [ Custom UI with Slots] ( #custom-ui-with-slots )
44- 1 . [ Multi-Factor Authentication] ( #multi-factor-authentication )
45- 1 . [ MFA Configuration] ( #mfa-configuration )
46- 1 . [ MFA Enrollment] ( #mfa-enrollment )
47- 1 . [ MFA Challenge] ( #mfa-challenge )
48- 1 . [ Theming & Customization] ( #theming--customization )
49- 1 . [ Material Theme Integration] ( #material-theme-integration )
50- 1 . [ Custom Theme] ( #custom-theme )
51- 1 . [ Provider Button Styling] ( #provider-button-styling )
52- 1 . [ Advanced Features] ( #advanced-features )
53- 1 . [ Anonymous User Upgrade] ( #anonymous-user-upgrade )
54- 1 . [ Email Link Sign-In] ( #email-link-sign-in )
55- 1 . [ Password Validation Rules] ( #password-validation-rules )
56- 1 . [ Credential Manager Integration] ( #credential-manager-integration )
57- 1 . [ Sign Out & Account Deletion] ( #sign-out--account-deletion )
58- 1 . [ Localization] ( #localization )
59- 1 . [ Error Handling] ( #error-handling )
60- 1 . [ Migration Guide] ( #migration-guide )
21+ 2 . [ Setup] ( #setup )
22+ - [ Prerequisites] ( #prerequisites )
23+ - [ Installation] ( #installation )
24+ - [ Provider Configuration] ( #provider-configuration )
25+ 3 . [ Quick Start] ( #quick-start )
26+ - [ Minimal Example] ( #minimal-example )
27+ - [ Check Authentication State] ( #check-authentication-state )
28+
29+ ### Core Concepts
30+ 4 . [ Core Concepts] ( #core-concepts )
31+ - [ FirebaseAuthUI] ( #firebaseauthui )
32+ - [ AuthUIConfiguration] ( #authuiconfiguration )
33+ - [ AuthFlowController] ( #authflowcontroller )
34+ - [ AuthState] ( #authstate )
35+
36+ ### Authentication
37+ 5 . [ Authentication Methods] ( #authentication-methods )
38+ - [ Email & Password] ( #email--password )
39+ - [ Phone Number] ( #phone-number )
40+ - [ Google Sign-In] ( #google-sign-in )
41+ - [ Facebook Login] ( #facebook-login )
42+ - [ Other OAuth Providers] ( #other-oauth-providers )
43+ - [ Anonymous Authentication] ( #anonymous-authentication )
44+ - [ Custom OAuth Provider] ( #custom-oauth-provider )
45+ 6 . [ Multi-Factor Authentication] ( #multi-factor-authentication )
46+ - [ MFA Configuration] ( #mfa-configuration )
47+ - [ MFA Enrollment] ( #mfa-enrollment )
48+ - [ MFA Challenge] ( #mfa-challenge )
49+
50+ ### Implementation
51+ 7 . [ Usage Patterns] ( #usage-patterns )
52+ - [ High-Level API (Recommended)] ( #high-level-api-recommended )
53+ - [ Low-Level API (Advanced)] ( #low-level-api-advanced )
54+ - [ Custom UI with Slots] ( #custom-ui-with-slots )
55+ 8 . [ Theming & Customization] ( #theming--customization )
56+ - [ Using Default Themes] ( #using-default-themes )
57+ - [ Customizing Default Theme] ( #customizing-default-theme )
58+ - [ Inheriting from Material Theme] ( #inheriting-from-material-theme )
59+ - [ Creating a Completely Custom Theme] ( #creating-a-completely-custom-theme )
60+ - [ Provider Button Styling] ( #provider-button-styling )
61+
62+ ### Advanced
63+ 9 . [ Advanced Features] ( #advanced-features )
64+ - [ Anonymous User Upgrade] ( #anonymous-user-upgrade )
65+ - [ Email Link Sign-In] ( #email-link-sign-in )
66+ - [ Password Validation Rules] ( #password-validation-rules )
67+ - [ Credential Manager Integration] ( #credential-manager-integration )
68+ - [ Sign Out & Account Deletion] ( #sign-out--account-deletion )
69+ 10 . [ Localization] ( #localization )
70+ 11 . [ Error Handling] ( #error-handling )
71+ 12 . [ Migration Guide] ( #migration-guide )
6172
6273## Demo
6374
@@ -970,17 +981,50 @@ fun ManualMfaChallenge(resolver: MultiFactorResolver) {
970981
971982## Theming & Customization
972983
973- ### Material Theme Integration
984+ FirebaseUI Auth provides flexible theming options to match your app's design:
974985
975- FirebaseUI automatically inherits your app's Material Theme:
986+ - ** ` AuthUITheme.Default ` ** / ** ` AuthUITheme.DefaultDark ` ** - Pre-configured Material Design 3 themes
987+ - ** ` .copy() ` ** - Customize specific properties of the default themes (data class)
988+ - ** ` fromMaterialTheme() ` ** - Inherit from your app's existing Material Theme
989+ - ** Custom theme** - Full control over colors, typography, shapes, and provider button styles
990+
991+ ### Using Default Themes
992+
993+ FirebaseUI provides pre-configured themes for light and dark modes:
994+
995+ ``` kotlin
996+ val configuration = authUIConfiguration {
997+ providers = listOf (AuthProvider .Email (), AuthProvider .Google ())
998+ theme = AuthUITheme .Default // or AuthUITheme.DefaultDark
999+ }
1000+ ```
1001+
1002+ ### Customizing Default Theme
1003+
1004+ Use ` .copy() ` to customize specific properties of the default theme:
1005+
1006+ ``` kotlin
1007+ val customTheme = AuthUITheme .Default .copy(
1008+ providerButtonShape = MaterialTheme .shapes.extraLarge // Pill-shaped buttons
1009+ )
1010+
1011+ val configuration = authUIConfiguration {
1012+ providers = listOf (AuthProvider .Google (), AuthProvider .Email ())
1013+ theme = customTheme
1014+ }
1015+ ```
1016+
1017+ ### Inheriting from Material Theme
1018+
1019+ Use ` fromMaterialTheme() ` to automatically inherit your app's Material Design theme:
9761020
9771021``` kotlin
9781022@Composable
9791023fun App () {
9801024 MyAppTheme { // Your existing Material3 theme
9811025 val configuration = authUIConfiguration {
9821026 providers = listOf (AuthProvider .Email ())
983- theme = AuthUITheme .fromMaterialTheme() // Inherits MyAppTheme
1027+ theme = AuthUITheme .fromMaterialTheme() // Inherits colors, typography, shapes
9841028 }
9851029
9861030 FirebaseAuthScreen (
@@ -991,9 +1035,20 @@ fun App() {
9911035}
9921036```
9931037
994- ### Custom Theme
1038+ You can also customize while inheriting:
9951039
996- Create a completely custom theme:
1040+ ``` kotlin
1041+ val configuration = authUIConfiguration {
1042+ providers = listOf (AuthProvider .Google (), AuthProvider .Facebook ())
1043+ theme = AuthUITheme .fromMaterialTheme(
1044+ providerButtonShape = RoundedCornerShape (16 .dp) // Override button shape
1045+ )
1046+ }
1047+ ```
1048+
1049+ ### Creating a Completely Custom Theme
1050+
1051+ Build a theme from scratch with full control:
9971052
9981053``` kotlin
9991054val customTheme = AuthUITheme (
@@ -1011,7 +1066,8 @@ val customTheme = AuthUITheme(
10111066 small = RoundedCornerShape (4 .dp),
10121067 medium = RoundedCornerShape (8 .dp),
10131068 large = RoundedCornerShape (16 .dp)
1014- )
1069+ ),
1070+ providerButtonShape = RoundedCornerShape (12 .dp)
10151071)
10161072
10171073val configuration = authUIConfiguration {
@@ -1022,31 +1078,126 @@ val configuration = authUIConfiguration {
10221078
10231079### Provider Button Styling
10241080
1025- Customize individual provider button styling:
1081+ #### Setting shapes for all provider buttons
1082+
1083+ ** Option 1: Using ` .copy() ` on default theme:**
1084+
1085+ ``` kotlin
1086+ val customTheme = AuthUITheme .Default .copy(
1087+ providerButtonShape = RoundedCornerShape (12 .dp) // Applies to all provider buttons
1088+ )
1089+
1090+ val configuration = authUIConfiguration {
1091+ providers = listOf (AuthProvider .Google (), AuthProvider .Facebook (), AuthProvider .Email ())
1092+ theme = customTheme
1093+ }
1094+ ```
1095+
1096+ ** Option 2: Using ` fromMaterialTheme() ` :**
1097+
1098+ ``` kotlin
1099+ val configuration = authUIConfiguration {
1100+ providers = listOf (AuthProvider .Google (), AuthProvider .Facebook ())
1101+ theme = AuthUITheme .fromMaterialTheme(
1102+ providerButtonShape = RoundedCornerShape (16 .dp)
1103+ )
1104+ }
1105+ ```
1106+
1107+ ** Option 3: Creating custom theme:**
1108+
1109+ ``` kotlin
1110+ val customTheme = AuthUITheme (
1111+ colorScheme = MaterialTheme .colorScheme,
1112+ typography = MaterialTheme .typography,
1113+ shapes = MaterialTheme .shapes,
1114+ providerButtonShape = RoundedCornerShape (12 .dp)
1115+ )
1116+
1117+ val configuration = authUIConfiguration {
1118+ providers = listOf (AuthProvider .Google (), AuthProvider .Facebook (), AuthProvider .Email ())
1119+ theme = customTheme
1120+ }
1121+ ```
1122+
1123+ #### Customizing individual provider buttons
1124+
1125+ Customize specific provider buttons using the pre-defined ` ProviderStyleDefaults ` constants:
1126+
1127+ ** Using ` .copy() ` with default theme:**
10261128
10271129``` kotlin
10281130val customProviderStyles = mapOf (
1029- " google.com" to AuthUITheme .ProviderStyle (
1030- backgroundColor = Color .White ,
1031- contentColor = Color (0xFF757575 ),
1032- iconTint = null , // Use original colors
1131+ " google.com" to ProviderStyleDefaults .Google .copy(
10331132 shape = RoundedCornerShape (8 .dp),
10341133 elevation = 4 .dp
10351134 ),
1036- " facebook.com" to AuthUITheme .ProviderStyle (
1037- backgroundColor = Color (0xFF1877F2 ),
1038- contentColor = Color .White ,
1039- shape = RoundedCornerShape (12 .dp),
1135+ " facebook.com" to ProviderStyleDefaults .Facebook .copy(
1136+ shape = RoundedCornerShape (24 .dp),
10401137 elevation = 0 .dp
10411138 )
10421139)
10431140
10441141val customTheme = AuthUITheme .Default .copy(
1045- providerStyles = customProviderStyles
1142+ providerButtonShape = RoundedCornerShape (12 .dp), // Default for all
1143+ providerStyles = customProviderStyles // Specific overrides
1144+ )
1145+
1146+ val configuration = authUIConfiguration {
1147+ providers = listOf (AuthProvider .Google (), AuthProvider .Facebook ())
1148+ theme = customTheme
1149+ }
1150+ ```
1151+
1152+ ** Using ` fromMaterialTheme() ` :**
1153+
1154+ ``` kotlin
1155+ val customProviderStyles = mapOf (
1156+ " google.com" to ProviderStyleDefaults .Google .copy(
1157+ shape = RoundedCornerShape (8 .dp),
1158+ elevation = 4 .dp
1159+ )
10461160)
10471161
10481162val configuration = authUIConfiguration {
10491163 providers = listOf (AuthProvider .Google (), AuthProvider .Facebook ())
1164+ theme = AuthUITheme .fromMaterialTheme(
1165+ providerButtonShape = RoundedCornerShape (12 .dp),
1166+ providerStyles = customProviderStyles
1167+ )
1168+ }
1169+ ```
1170+
1171+ #### Complete customization example
1172+
1173+ Real-world example combining global and per-provider customizations:
1174+
1175+ ``` kotlin
1176+ // Define custom styles for specific providers
1177+ val customProviderStyles = mapOf (
1178+ " google.com" to ProviderStyleDefaults .Google .copy(
1179+ shape = RoundedCornerShape (24 .dp), // Pill-shaped Google button
1180+ elevation = 6 .dp
1181+ ),
1182+ " facebook.com" to ProviderStyleDefaults .Facebook .copy(
1183+ shape = RoundedCornerShape (8 .dp), // Medium rounded Facebook button
1184+ elevation = 0 .dp // Flat design
1185+ )
1186+ // Email provider will use the global providerButtonShape
1187+ )
1188+
1189+ // Customize default theme with global button shape and per-provider styles
1190+ val customTheme = AuthUITheme .Default .copy(
1191+ providerButtonShape = RoundedCornerShape (12 .dp), // Global default for all buttons
1192+ providerStyles = customProviderStyles // Specific overrides
1193+ )
1194+
1195+ val configuration = authUIConfiguration {
1196+ providers = listOf (
1197+ AuthProvider .Google (), // Uses custom shape (24.dp)
1198+ AuthProvider .Facebook (), // Uses custom shape (8.dp)
1199+ AuthProvider .Email () // Uses global shape (12.dp)
1200+ )
10501201 theme = customTheme
10511202}
10521203```
0 commit comments