Skip to content

Commit f0d8de1

Browse files
committed
chore: update readme
1 parent dbd0f7e commit f0d8de1

File tree

1 file changed

+143
-6
lines changed

1 file changed

+143
-6
lines changed

README.md

Lines changed: 143 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ Next, follow the framework specific installation steps, for either React, Shadcn
217217
`,
218218
})
219219
export class SignInRoute {
220-
onSignIn(credential: UserCredential) {
220+
onSignIn(user: User) {
221221
// ...
222222
}
223223
}
@@ -238,6 +238,14 @@ Ensure your application imports the Firebase UI CSS file. This can be handled a
238238

239239
If your bundler supports importing CSS files from node_modules:
240240

241+
Via JS:
242+
243+
```ts
244+
import '@invertase/firebaseui-styles/dist.min.css';
245+
```
246+
247+
Via CSS:
248+
241249
```css
242250
@import "@invertase/firebaseui-styles/dist.min.css";
243251
```
@@ -1042,10 +1050,21 @@ By default, any missing translations will fallback to English if not specified.
10421050

10431051
Screen component for email/password sign-in. Extends `SignInAuthFormProps` and accepts `children`.
10441052

1053+
| Prop | Type | Description |
1054+
|------|:----:|-------------|
1055+
| onSignIn | `(user: User) => void?` | Callback when sign-in succeeds |
1056+
| onForgotPasswordClick | `() => void?` | Callback when forgot password link is clicked |
1057+
| onSignUpClick | `() => void?` | Callback when sign-up link is clicked |
1058+
10451059
**`SignUpAuthScreen`**
10461060

10471061
Screen component for email/password sign-up. Extends `SignUpAuthFormProps` and accepts `children`.
10481062

1063+
| Prop | Type | Description |
1064+
|------|:----:|-------------|
1065+
| onSignUp | `(user: User) => void?` | Callback when sign-up succeeds |
1066+
| onSignInClick | `() => void?` | Callback when sign-in link is clicked |
1067+
10491068
**`ForgotPasswordAuthScreen`**
10501069

10511070
Screen component for password reset. Extends `ForgotPasswordAuthFormProps`.
@@ -1054,14 +1073,28 @@ By default, any missing translations will fallback to English if not specified.
10541073

10551074
Screen component for email link authentication. Extends `EmailLinkAuthFormProps` and accepts `children`.
10561075

1076+
| Prop | Type | Description |
1077+
|------|:----:|-------------|
1078+
| onSendSignInLinkToEmail | `() => void?` | Callback when sign-in link email is sent |
1079+
| onSignIn | `(user: User) => void?` | Callback when sign-in succeeds |
1080+
10571081
**`PhoneAuthScreen`**
10581082

10591083
Screen component for phone number authentication. Extends `PhoneAuthFormProps` and accepts `children`.
10601084

1085+
| Prop | Type | Description |
1086+
|------|:----:|-------------|
1087+
| onVerifyPhoneNumber | `() => void?` | Callback when phone number verification is initiated |
1088+
| onVerifyCode | `(user: User) => void?` | Callback when verification code is verified |
1089+
10611090
**`MultiFactorAuthAssertionScreen`**
10621091

10631092
Screen component for multi-factor authentication assertion. Extends `MultiFactorAuthAssertionFormProps`.
10641093

1094+
| Prop | Type | Description |
1095+
|------|:----:|-------------|
1096+
| onAssert | `(user: User) => void?` | Callback when MFA assertion succeeds |
1097+
10651098
**`MultiFactorAuthEnrollmentScreen`**
10661099

10671100
Screen component for multi-factor authentication enrollment. Extends `MultiFactorAuthEnrollmentFormProps`.
@@ -1072,6 +1105,7 @@ By default, any missing translations will fallback to English if not specified.
10721105

10731106
| Prop | Type | Description |
10741107
|------|:----:|-------------|
1108+
| onSignIn | `(user: User) => void?` | Callback when sign-in succeeds |
10751109
| children | `React.ReactNode?` | Child components |
10761110

10771111
**`OAuthButton`**
@@ -1082,6 +1116,7 @@ By default, any missing translations will fallback to English if not specified.
10821116
|------|:----:|-------------|
10831117
| provider | `AuthProvider` | Firebase Auth provider instance |
10841118
| themed | `boolean \| string?` | Whether to apply themed styling |
1119+
| onSignIn | `(credential: UserCredential) => void?` | Callback when sign-in succeeds |
10851120
| children | `React.ReactNode?` | Button content |
10861121

10871122
**`GoogleSignInButton`**
@@ -1091,6 +1126,7 @@ By default, any missing translations will fallback to English if not specified.
10911126
| Prop | Type | Description |
10921127
|------|:----:|-------------|
10931128
| themed | `boolean \| string?` | Whether to apply themed styling |
1129+
| onSignIn | `(credential: UserCredential) => void?` | Callback when sign-in succeeds |
10941130

10951131
**`AppleSignInButton`**
10961132

@@ -1099,6 +1135,7 @@ By default, any missing translations will fallback to English if not specified.
10991135
| Prop | Type | Description |
11001136
|------|:----:|-------------|
11011137
| themed | `boolean \| string?` | Whether to apply themed styling |
1138+
| onSignIn | `(credential: UserCredential) => void?` | Callback when sign-in succeeds |
11021139

11031140
**`FacebookSignInButton`**
11041141

@@ -1107,6 +1144,7 @@ By default, any missing translations will fallback to English if not specified.
11071144
| Prop | Type | Description |
11081145
|------|:----:|-------------|
11091146
| themed | `boolean \| string?` | Whether to apply themed styling |
1147+
| onSignIn | `(credential: UserCredential) => void?` | Callback when sign-in succeeds |
11101148

11111149
**`GitHubSignInButton`**
11121150

@@ -1115,6 +1153,7 @@ By default, any missing translations will fallback to English if not specified.
11151153
| Prop | Type | Description |
11161154
|------|:----:|-------------|
11171155
| themed | `boolean \| string?` | Whether to apply themed styling |
1156+
| onSignIn | `(credential: UserCredential) => void?` | Callback when sign-in succeeds |
11181157

11191158
**`MicrosoftSignInButton`**
11201159

@@ -1123,6 +1162,7 @@ By default, any missing translations will fallback to English if not specified.
11231162
| Prop | Type | Description |
11241163
|------|:----:|-------------|
11251164
| themed | `boolean \| string?` | Whether to apply themed styling |
1165+
| onSignIn | `(credential: UserCredential) => void?` | Callback when sign-in succeeds |
11261166

11271167
**`TwitterSignInButton`**
11281168

@@ -1131,6 +1171,7 @@ By default, any missing translations will fallback to English if not specified.
11311171
| Prop | Type | Description |
11321172
|------|:----:|-------------|
11331173
| themed | `boolean \| string?` | Whether to apply themed styling |
1174+
| onSignIn | `(credential: UserCredential) => void?` | Callback when sign-in succeeds |
11341175

11351176
**`Button`**
11361177

@@ -1655,7 +1696,7 @@ By default, any missing translations will fallback to English if not specified.
16551696

16561697
| Output | Type | Description |
16571698
|--------|:----:|-------------|
1658-
| signIn | `EventEmitter<UserCredential>` | Emitted when sign-in succeeds |
1699+
| signIn | `EventEmitter<User>` | Emitted when sign-in succeeds |
16591700
| signUp | `EventEmitter<void>` | Emitted when sign-up link is clicked |
16601701

16611702
**`SignUpAuthScreenComponent`**
@@ -1666,7 +1707,7 @@ By default, any missing translations will fallback to English if not specified.
16661707

16671708
| Output | Type | Description |
16681709
|--------|:----:|-------------|
1669-
| signUp | `EventEmitter<UserCredential>` | Emitted when sign-up succeeds |
1710+
| signUp | `EventEmitter<User>` | Emitted when sign-up succeeds |
16701711
| signIn | `EventEmitter<void>` | Emitted when sign-in link is clicked |
16711712

16721713
**`ForgotPasswordAuthScreenComponent`**
@@ -1689,7 +1730,7 @@ By default, any missing translations will fallback to English if not specified.
16891730
| Output | Type | Description |
16901731
|--------|:----:|-------------|
16911732
| emailSent | `EventEmitter<void>` | Emitted when sign-in link email is sent |
1692-
| signIn | `EventEmitter<UserCredential>` | Emitted when sign-in succeeds |
1733+
| signIn | `EventEmitter<User>` | Emitted when sign-in succeeds |
16931734

16941735
**`PhoneAuthScreenComponent`**
16951736

@@ -1699,7 +1740,7 @@ By default, any missing translations will fallback to English if not specified.
16991740

17001741
| Output | Type | Description |
17011742
|--------|:----:|-------------|
1702-
| signIn | `EventEmitter<UserCredential>` | Emitted when phone verification succeeds |
1743+
| signIn | `EventEmitter<User>` | Emitted when phone verification succeeds |
17031744

17041745
**`OAuthScreenComponent`**
17051746

@@ -1709,7 +1750,7 @@ By default, any missing translations will fallback to English if not specified.
17091750

17101751
| Output | Type | Description |
17111752
|--------|:----:|-------------|
1712-
| onSignIn | `EventEmitter<UserCredential>` | Emitted when OAuth sign-in succeeds |
1753+
| onSignIn | `EventEmitter<User>` | Emitted when OAuth sign-in succeeds |
17131754

17141755
**`OAuthButtonComponent`**
17151756

@@ -1721,42 +1762,70 @@ By default, any missing translations will fallback to English if not specified.
17211762
|-------|:----:|-------------|
17221763
| provider | `AuthProvider` | Firebase Auth provider instance |
17231764

1765+
| Output | Type | Description |
1766+
|--------|:----:|-------------|
1767+
| signIn | `EventEmitter<UserCredential>` | Emitted when sign-in succeeds |
1768+
17241769
**`GoogleSignInButtonComponent`**
17251770

17261771
Selector: `fui-google-sign-in-button`
17271772

17281773
Google OAuth sign-in button component.
17291774

1775+
| Output | Type | Description |
1776+
|--------|:----:|-------------|
1777+
| signIn | `EventEmitter<UserCredential>` | Emitted when sign-in succeeds |
1778+
17301779
**`AppleSignInButtonComponent`**
17311780

17321781
Selector: `fui-apple-sign-in-button`
17331782

17341783
Apple OAuth sign-in button component.
17351784

1785+
| Output | Type | Description |
1786+
|--------|:----:|-------------|
1787+
| signIn | `EventEmitter<UserCredential>` | Emitted when sign-in succeeds |
1788+
17361789
**`FacebookSignInButtonComponent`**
17371790

17381791
Selector: `fui-facebook-sign-in-button`
17391792

17401793
Facebook OAuth sign-in button component.
17411794

1795+
| Output | Type | Description |
1796+
|--------|:----:|-------------|
1797+
| signIn | `EventEmitter<UserCredential>` | Emitted when sign-in succeeds |
1798+
17421799
**`GithubSignInButtonComponent`**
17431800

17441801
Selector: `fui-github-sign-in-button`
17451802

17461803
GitHub OAuth sign-in button component.
17471804

1805+
| Output | Type | Description |
1806+
|--------|:----:|-------------|
1807+
| signIn | `EventEmitter<UserCredential>` | Emitted when sign-in succeeds |
1808+
17481809
**`MicrosoftSignInButtonComponent`**
17491810

17501811
Selector: `fui-microsoft-sign-in-button`
17511812

17521813
Microsoft OAuth sign-in button component.
17531814

1815+
| Output | Type | Description |
1816+
|--------|:----:|-------------|
1817+
| signIn | `EventEmitter<UserCredential>` | Emitted when sign-in succeeds |
1818+
17541819
**`TwitterSignInButtonComponent`**
17551820

17561821
Selector: `fui-twitter-sign-in-button`
17571822

17581823
Twitter OAuth sign-in button component.
17591824

1825+
| Output | Type | Description |
1826+
|--------|:----:|-------------|
1827+
| signIn | `EventEmitter<UserCredential>` | Emitted when sign-in succeeds |
1828+
17601829
**`ButtonComponent`**
17611830

17621831
Selector: `button[fui-button]`
@@ -2038,5 +2107,73 @@ ui.listen((ui) => {
20382107

20392108
The core package additionally exposes a `signInWithMultiFactorAssertion` function for signing the user in with one of their enrolled factors.
20402109

2110+
### Custom providers
2111+
2112+
Out of the box, Firebase UI provides styled, themeable buttons for all of the Firebase supported providers. If you wish to add a custom provider, either
2113+
supporting SAML or OIDC, you can achive this by extending the OAuth component:
2114+
2115+
<details>
2116+
<summary>React</summary>
2117+
2118+
```tsx
2119+
import { OAuthProvider } from 'firebase/auth';
2120+
import { OAuthButton } from '@invertase/firebaseui-react';
2121+
2122+
function MyProviderButton() {
2123+
// Get the provider ID from the Firebase Console
2124+
const provider = new OAuthProvider('oidc.my-provider');
20412125

2126+
return (
2127+
<OAuthButton provider={provider} themed>
2128+
Sign in with my provider
2129+
</OAuthButton>
2130+
)
2131+
}
2132+
```
2133+
</details>
2134+
2135+
<details>
2136+
<summary>Angular</summary>
2137+
2138+
```ts
2139+
import { Component } from '@angular/core';
2140+
import { CommonModule } from '@angular/common';
2141+
import { OAuthProvider, UserCredential } from '@angular/fire/auth';
2142+
import { OAuthButtonComponent } from '@invertase/firebaseui-angular';
2143+
2144+
@Component({
2145+
selector: 'app-my-provider-button',
2146+
standalone: true,
2147+
imports: [CommonModule, OAuthButtonComponent],
2148+
template: `
2149+
<fui-oauth-button [provider]="provider" [themed]="true">
2150+
Sign in with my provider
2151+
</fui-oauth-button>
2152+
`,
2153+
})
2154+
export class MyProviderButtonComponent {
2155+
// Get the provider ID from the Firebase Console
2156+
provider = new OAuthProvider('oidc.my-provider');
2157+
2158+
onSignIn(credential: UserCredential) {
2159+
// Handle sign-in success
2160+
}
2161+
}
2162+
```
2163+
</details>
2164+
2165+
If the `themed` prop is provided, you can trigger the styling via providing some custom CSS which targets the button:
2166+
2167+
```css
2168+
.fui-provider__button[data-provider="oidc.my-provider"][data-themed="true"] {
2169+
--my-provider: blue;
2170+
--color-primary: var(--my-provider);
2171+
--color-primary-hover: --alpha(var(--my-provider) / 85%);
2172+
--color-primary-surface: #FFFFFF;
2173+
--color-border: var(--my-provider);
2174+
}
20422175

2176+
/* If using Shadcn */
2177+
button[data-provider="oidc.my-provider"][data-themed="true"] {
2178+
...
2179+
```

0 commit comments

Comments
 (0)