You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: dist/README.md
+43-11Lines changed: 43 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,20 +22,25 @@ npm install --save firebase
22
22
```
23
23
24
24
In your app:
25
-
1. Import the `FirebaseAuth` component from `react-firebaseui` and import `firebase`.
25
+
1. Import the `FirebaseAuth`or the `StyledFirebaseAuth`component from `react-firebaseui` and import `firebase`.
26
26
2. Configure Firebase as described in [the Firebase Docs](https://firebase.google.com/docs/web/setup).
27
27
3. Write a Firebase UI configuration as described in [firebase/firebaseui-web](https://github.com/firebase/firebaseui-web#configuration).
28
28
4. Use the `FirebaseAuth` component in your template passing it the **Firebase UI configuration** and a **Firebase Auth instance**.
29
29
30
30
31
-
### Using `FirebaseAuth` with a redirect
31
+
### `FirebaseAuth` vs `StyledFirebaseAuth`
32
+
33
+
There are two components that allow you to add FirebaseUI auth to your application: `FirebaseAuth` and `StyledFirebaseAuth`. The difference is that `FirebaseAuth` has a reference to the Firebase UI CSS (it `requires` the CSS) whereas `StyledFirebaseAuth` includes the CSS directly in its built. For simplicity you should use `StyledFirebaseAuth` and for better performances and build sizes you should use `FirebaseAuth`. `FirebaseAuth` is meant to be used with a CSS/style loader as part of yor webpack built configuration. See the [Packing your app](#packing) section
34
+
35
+
36
+
### Using `StyledFirebaseAuth` with a redirect
32
37
33
38
Below is an example on how to use `FirebaseAuth` with a redirect upon sign-in:
@@ -134,9 +139,32 @@ class SignInScreen extends React.Component {
134
139
}
135
140
```
136
141
142
+
### Accessing the FirebaseUI instance
143
+
144
+
To allow for further configuration you can access the firebaseUI instance before it is started.
145
+
To do this you can pass a `uiCallback` callback function that wil be passed the Firebase UI instance. For example here is how to enable the `disableAutoSignIn()` option:
The `FirebaseAuth` component needs a global CSS to get proper styling. The CSS is already imported within `FirebaseAuth`.
165
+
If you are using the `StyledFirebaseAuth` component there should not be special configuration needed to package your app since the CSS is already included within the component. if you would like to extract the CSS you should use the `FirebaseAuth` component instead.
166
+
167
+
The `FirebaseAuth` needs a global CSS to get proper styling. The CSS is already imported within `FirebaseAuth`.
140
168
If you are using webpack you'll need to add [CSS loaders](https://github.com/webpack-contrib/css-loader):
141
169
142
170
```js
@@ -152,6 +180,8 @@ If you are using webpack you'll need to add [CSS loaders](https://github.com/web
152
180
}
153
181
```
154
182
183
+
PS: make sure your rule does not exclude `/node_modules/` as this is where the library, and therefore, the CSS is located.
184
+
155
185
### With ExtractTextPlugin
156
186
157
187
If you are using [`ExtractTextPlugin`](https://github.com/webpack-contrib/extract-text-webpack-plugin) to extract a CSS file from the required CSS files you would typically use:
@@ -174,6 +204,8 @@ If you are using [`ExtractTextPlugin`](https://github.com/webpack-contrib/extrac
174
204
}
175
205
```
176
206
207
+
PS: make sure your rule does not exclude `/node_modules/` as this is where the library, and therefore, the CSS is located.
208
+
177
209
### With ExtractTextPlugin and CSS modules
178
210
179
211
If you are using CSS modules in your app you need to handle the CSS files in `/node_modules/` in a separate loader so that they are imported as global CSS files and not modules. Your setup could look like:
@@ -222,10 +254,10 @@ If you are using CSS modules in your app you need to handle the CSS files in `/n
222
254
223
255
## Styling
224
256
225
-
To change the styling of the `FirebaseAuth` widget you can override its CSS. You can import a CSS that will be included globally in your packed application. For instance create a `firebaseui-overrides.globlal.css` file and import it in your app:
257
+
To change the styling of the `FirebaseAuth`or the `StyledFirebaseAuth`widget you can override some of its CSS. You can import a CSS that will be included globally in your packed application. For instance create a `firebaseui-overrides.global.css` file and import it in your app:
> Note: If you are using the "With ExtractTextPlugin and CSS modules" Webpack build rule above, the `.global.css` suffixe will make sure the CSS file is imported globally and not ran through modules support.
@@ -238,8 +270,8 @@ If you would like to see an example of styling, have a look at the [example app]
238
270
In the case where you would need to load multiple instances of `FirebaseAuth` at the same time you need to set them up with a different ID using the `elementId` attribute. For instance:
0 commit comments