Skip to content

Commit f6d9017

Browse files
authored
docs: Update README
1 parent 9e89d39 commit f6d9017

File tree

1 file changed

+162
-2
lines changed

1 file changed

+162
-2
lines changed

README.md

Lines changed: 162 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ This repository contains the source code for the FirebaseUI for Web project rewr
44

55
## Installation
66

7-
To get started, install the React or Angular package:
7+
FirebaseUI requires the `firebase` package to be installed:
8+
9+
```bash
10+
npm intall firebase
11+
```
12+
13+
Next, follow the installation flow for your framework:
814

915
<details>
1016
<summary>React</summary>
@@ -17,7 +23,161 @@ To get started, install the React or Angular package:
1723
<details>
1824
<summary>Angular</summary>
1925

26+
FirebaseUI for Angular dependes on the [AngularFire](https://github.com/angular/angularfire) package:
27+
2028
```bash
21-
npm install @firebase-ui/angular
29+
npm install @firebase-ui/angular @angular/fire
30+
```
31+
</details>
32+
33+
34+
## Setup
35+
36+
FirebaseUI requires that your Firebase app is setup following the [Getting Started with Firebase](https://firebase.google.com/docs/web/setup) flow for Web:
37+
38+
```ts
39+
import { initializeApp } from 'firebase/app';
40+
41+
const app = initializeApp({ ... });
42+
```
43+
44+
Next, setup and configure FirebaseUI, import the `initializeUI` function from `@firebase-ui/core`:
45+
46+
```ts
47+
import { initializeUI } from "@firebase-ui/core";
48+
49+
const ui = initializeUI();
50+
```
51+
52+
> To learn more about configuring FirebaseUI, view the [configuration](#configuration) section.
53+
54+
Next, follow the flow for your framework to setup FirebaseUI:
55+
56+
<details>
57+
<summary>React</summary>
58+
59+
FirebaseUI for React requires that your application be wrapped in the `ConfigProvider`, providing the initalized UI configuration. React expects the `FirebaseApp` instance be provided to the `initializeUI` configuration:
60+
61+
```tsx
62+
import { initializeApp } from 'firebase/app';
63+
import { initializeUI } from "@firebase-ui/core";
64+
import { ConfigProvider } from '@firebase-ui/react';
65+
66+
const app = initializeApp({ ... });
67+
const ui = initializeUI({ app });
68+
69+
createRoot(document.getElementById("root")!).render(
70+
<StrictMode>
71+
<ConfigProvider config={ui}>
72+
<App />
73+
</ConfigProvider>
74+
</StrictMode>
75+
);
76+
```
77+
</details>
78+
79+
<details>
80+
<summary>Angular</summary>
81+
82+
FirebaseUI depends on [AngularFire](https://github.com/angular/angularfire) being configured to inject Firebase Auth into your Angular application. Additionally, the `provideFirebaseUI` function is required to inject FirebaseUI into your application:
83+
84+
```tsx
85+
import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
86+
import { provideAuth, getAuth } from '@angular/fire/auth';
87+
import { provideFirebaseUI } from '@firebase-ui/angular';
88+
import { initializeUI } from '@firebase-ui/core';
89+
90+
export const appConfig: ApplicationConfig = {
91+
providers: [
92+
provideFirebaseApp(() => initializeApp({ ... })),
93+
provideFirestore(() => getFirestore()),
94+
provideFirebaseUI(() => initializeUI({}))
95+
...
96+
],
97+
...
98+
})
99+
```
100+
</details>
101+
102+
Next, import the CSS styles for the FirebaseUI project.
103+
104+
If you are using [TailwindCSS](https://tailwindcss.com/), import the base CSS from the `@firebase-ui/styles` package after your Tailwind import:
105+
106+
```css
107+
@import "tailwindcss";
108+
@import "@firebase-ui/styles/src/base.css";
109+
```
110+
111+
If you are not using Tailwind, import the distributable CSS in your project:
112+
113+
```css
114+
@import "@firebase-ui/styles/dist.css";
115+
```
116+
117+
> To learn more about theming, view the [theming](#theming) section.
118+
119+
## Authentication Components
120+
121+
FirebaseUI provides a number of opinionated components designed to drop into your application which handle common user flows, such as signing in or registration.
122+
123+
### Sign-in
124+
125+
Allows users to sign in with an email and password:
126+
127+
<details>
128+
<summary>React</summary>
129+
130+
```tsx
131+
import { SignInAuthScreen } from '@firebase-ui/react';
132+
133+
function App() {
134+
return <SignInAuthScreen />
135+
}
136+
```
137+
138+
Props: `onForgotPasswordClick` / `onRegisterClick`
139+
140+
Additionally, allow the user to sign in with an OAuth provider by providing children:
141+
142+
```tsx
143+
import { SignInAuthScreen, GoogleSignInButton } from '@firebase-ui/react';
144+
145+
function App() {
146+
return (
147+
<SignInAuthScreen>
148+
<GoogleSignInButton />
149+
</SignInAuthScreen>
150+
);
151+
}
152+
```
153+
</details>
154+
155+
<details>
156+
<summary>Angular</summary>
157+
158+
```tsx
159+
import { SignUpAuthScreenComponent } from "@firebase-ui/angular";
160+
161+
@Component({
162+
selector: 'app-root',
163+
imports: [SignUpAuthScreenComponent],
164+
template: `<fui-sign-up-auth-screen></fui-sign-up-auth-screen>`,
165+
})
166+
export class AppComponent { }
167+
```
168+
169+
TODO: Props: `onForgotPasswordClick` / `onRegisterClick`
170+
171+
TODO: Additionally, allow the user to sign in with an OAuth provider by providing children:
172+
173+
```tsx
174+
import { SignUpAuthScreenComponent } from "@firebase-ui/angular";
175+
176+
@Component({
177+
selector: 'app-root',
178+
imports: [SignUpAuthScreenComponent],
179+
template: `<fui-sign-up-auth-screen></fui-sign-up-auth-screen>`,
180+
})
181+
export class AppComponent { }
22182
```
23183
</details>

0 commit comments

Comments
 (0)