diff --git a/examples/react/src/App.tsx b/examples/react/src/App.tsx
index a6830ddcd..d35bc2830 100644
--- a/examples/react/src/App.tsx
+++ b/examples/react/src/App.tsx
@@ -55,7 +55,7 @@ function UnauthenticatedApp() {
Full Customization Demo
- A complete sign in flow with its own UI and three switchable themes, built on the ui-react hooks.
+ A complete sign in flow with its own UI and four switchable themes, built on the ui-react hooks.
);
}
+/** The example's light/dark toggle is hidden on this route, so Professional, which follows it, gets its own. */
+function DarkModeToggle() {
+ const [dark, setDark] = useState(() => document.documentElement.classList.contains("dark"));
+
+ return (
+ {
+ const next = !dark;
+ document.documentElement.classList.toggle("dark", next);
+ try {
+ window.localStorage.setItem("theme", next ? "dark" : "light");
+ } catch {
+ // Storage can be unavailable (private mode), the switch still works for this visit.
+ }
+ setDark(next);
+ }}
+ >
+
+ {dark ? "dark_mode" : "light_mode"}
+
+
+ );
+}
+
/**
* Background art for each theme, positioned with the offsets of the matching layer in its Figma
* frame: "pattern" in 20:6031, "grid" in 20:7310 and "avatar spark" in 20:6675.
diff --git a/examples/react/src/main.tsx b/examples/react/src/main.tsx
index dbaadbeae..f85b94fcd 100644
--- a/examples/react/src/main.tsx
+++ b/examples/react/src/main.tsx
@@ -93,11 +93,15 @@ class ChunkErrorBoundary extends Component<{ children: ReactNode }, { failed: bo
return { failed: true };
}
+ componentDidCatch(error: unknown) {
+ console.error(error);
+ }
+
render() {
if (!this.state.failed) return this.props.children;
return (
- The demo failed to load.{" "}
+ Something went wrong.{" "}
window.location.reload()}>
Reload
diff --git a/examples/shadcn/src/App.tsx b/examples/shadcn/src/App.tsx
index 46aa27dfc..eaa6a0cba 100644
--- a/examples/shadcn/src/App.tsx
+++ b/examples/shadcn/src/App.tsx
@@ -55,6 +55,21 @@ function UnauthenticatedApp() {
Welcome to Firebase UI, choose an example screen below to get started!
+
+
+ Full Customization Demo
+
+ A complete sign in flow built from this example's shadcn/ui components, with four switchable themes.
+
+
+
+
+
+
+
+
+
+
{routes.map((route) => (
diff --git a/examples/shadcn/src/components/ui/dialog.tsx b/examples/shadcn/src/components/ui/dialog.tsx
new file mode 100644
index 000000000..13adcd1e4
--- /dev/null
+++ b/examples/shadcn/src/components/ui/dialog.tsx
@@ -0,0 +1,121 @@
+import * as React from "react";
+import * as DialogPrimitive from "@radix-ui/react-dialog";
+import { XIcon } from "lucide-react";
+
+import { cn } from "@/lib/utils";
+
+function Dialog({ ...props }: React.ComponentProps) {
+ return ;
+}
+
+function DialogTrigger({ ...props }: React.ComponentProps) {
+ return ;
+}
+
+function DialogPortal({ ...props }: React.ComponentProps) {
+ return ;
+}
+
+function DialogClose({ ...props }: React.ComponentProps) {
+ return ;
+}
+
+function DialogOverlay({ className, ...props }: React.ComponentProps) {
+ return (
+
+ );
+}
+
+function DialogContent({
+ className,
+ children,
+ showCloseButton = true,
+ ...props
+}: React.ComponentProps & {
+ showCloseButton?: boolean;
+}) {
+ return (
+
+
+
+ {children}
+ {showCloseButton && (
+
+
+ Close
+
+ )}
+
+
+ );
+}
+
+function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+
+ );
+}
+
+function DialogFooter({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+
+ );
+}
+
+function DialogTitle({ className, ...props }: React.ComponentProps) {
+ return (
+
+ );
+}
+
+function DialogDescription({ className, ...props }: React.ComponentProps) {
+ return (
+
+ );
+}
+
+export {
+ Dialog,
+ DialogClose,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogOverlay,
+ DialogPortal,
+ DialogTitle,
+ DialogTrigger,
+};
diff --git a/examples/shadcn/src/full-customization/assets/doggo-mascot.svg b/examples/shadcn/src/full-customization/assets/doggo-mascot.svg
new file mode 100644
index 000000000..2991f829c
--- /dev/null
+++ b/examples/shadcn/src/full-customization/assets/doggo-mascot.svg
@@ -0,0 +1,14 @@
+
diff --git a/examples/shadcn/src/full-customization/assets/doggo-pattern.svg b/examples/shadcn/src/full-customization/assets/doggo-pattern.svg
new file mode 100644
index 000000000..dadd187af
--- /dev/null
+++ b/examples/shadcn/src/full-customization/assets/doggo-pattern.svg
@@ -0,0 +1,544 @@
+
diff --git a/examples/shadcn/src/full-customization/assets/grid-pattern.svg b/examples/shadcn/src/full-customization/assets/grid-pattern.svg
new file mode 100644
index 000000000..1e4a5af88
--- /dev/null
+++ b/examples/shadcn/src/full-customization/assets/grid-pattern.svg
@@ -0,0 +1,90 @@
+
diff --git a/examples/shadcn/src/full-customization/assets/spark-blob.webp b/examples/shadcn/src/full-customization/assets/spark-blob.webp
new file mode 100644
index 000000000..1b9e974e2
Binary files /dev/null and b/examples/shadcn/src/full-customization/assets/spark-blob.webp differ
diff --git a/examples/shadcn/src/full-customization/components.tsx b/examples/shadcn/src/full-customization/components.tsx
new file mode 100644
index 000000000..c447e10d9
--- /dev/null
+++ b/examples/shadcn/src/full-customization/components.tsx
@@ -0,0 +1,322 @@
+/**
+ * Copyright 2025 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { createRef, useCallback, useState, type ComponentProps, type ReactNode } from "react";
+import { FirebaseError } from "firebase/app";
+import { REGEXP_ONLY_DIGITS } from "input-otp";
+import { FirebaseUIError, type CountryData } from "@firebase-oss/ui-core";
+import { GoogleLogo, useCountries, useRecaptchaVerifier, useUI } from "@firebase-oss/ui-react";
+
+import { Button as ShadcnButton } from "@/components/ui/button";
+import { Card } from "@/components/ui/card";
+import { Input } from "@/components/ui/input";
+import { InputOTP, InputOTPGroup, InputOTPSlot } from "@/components/ui/input-otp";
+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
+
+import mascot from "./assets/doggo-mascot.svg";
+
+type PageProps = {
+ /** Shown in the Doggo welcome bubble, and read by screen readers in every theme. */
+ title: string;
+ /** The line above the form. Spark and Grid use it as their visible heading. */
+ prompt: ReactNode;
+ children: ReactNode;
+ /** Rendered pinned to the bottom of the page, below the form. */
+ footer?: ReactNode;
+};
+
+export function Page({ title, prompt, children, footer }: PageProps) {
+ return (
+ <>
+
+
+
+ coffee
+
+ Coffee Spark
+
+
+
+ {title}
+
+
+
{prompt}
+ {children}
+
+
+ {footer}
+ >
+ );
+}
+
+type TextFieldProps = Omit, "className"> & {
+ /** A Material Symbols icon name for the leading slot. */
+ icon?: string;
+ invalid?: boolean;
+};
+
+export function TextField({ icon, invalid, type, placeholder, ...props }: TextFieldProps) {
+ const [revealed, setRevealed] = useState(false);
+ const isPassword = type === "password";
+
+ return (
+
+ );
+}
+
+type ProviderButtonProps = Omit, "className" | "type"> & {
+ provider: "google" | "phone" | "guest";
+};
+
+const providerIcons = {
+ google: ,
+ phone: (
+
+ phone
+
+ ),
+ guest: (
+
+ person
+
+ ),
+};
+
+export function ProviderButton({ provider, children, ...props }: ProviderButtonProps) {
+ return (
+
+ {providerIcons[provider]}
+ {children}
+
+ );
+}
+
+/**
+ * useRecaptchaVerifier, plus a way to start over. A reCAPTCHA token is single use, so after each
+ * send (failed, or before a resend) the container is swapped for a new one with a fresh verifier.
+ */
+export function useResettableRecaptcha() {
+ // The ref and the element key change together, so each reset gets a new element and a new verifier.
+ const [slot, setSlot] = useState(() => ({ key: 0, ref: createRef() }));
+ const verifier = useRecaptchaVerifier(slot.ref);
+
+ return {
+ verifier,
+ container: ,
+ reset: () => setSlot(({ key }) => ({ key: key + 1, ref: createRef() })),
+ };
+}
+
+/**
+ * Runs an auth call, tracking whether it is in flight and the message to show if it fails.
+ *
+ * The ui-react action hooks throw errors whose message is already translated. Calls made straight
+ * to firebase/auth throw a raw FirebaseError, which is translated here with FirebaseUIError.
+ */
+export function useAuthTask() {
+ const ui = useUI();
+ const [pending, setPending] = useState(false);
+ const [error, setError] = useState(null);
+
+ const run = useCallback(
+ async (task: () => Promise): Promise => {
+ setPending(true);
+ setError(null);
+ try {
+ return await task();
+ } catch (e) {
+ if (e instanceof FirebaseError && !(e instanceof FirebaseUIError)) {
+ setError(new FirebaseUIError(ui, e).message);
+ } else if (!(e instanceof ReauthCancelledError)) {
+ setError(e instanceof Error ? e.message : String(e));
+ }
+ return undefined;
+ } finally {
+ setPending(false);
+ }
+ },
+ [ui]
+ );
+
+ return { pending, error, setError, run };
+}
+
+/** Thrown when the user dismisses the reauthentication dialog, which is a cancellation rather than a failure. */
+export class ReauthCancelledError extends Error {
+ constructor() {
+ super("Reauthentication cancelled");
+ }
+}
diff --git a/examples/shadcn/src/full-customization/full-customization.css b/examples/shadcn/src/full-customization/full-customization.css
new file mode 100644
index 000000000..46980dd41
--- /dev/null
+++ b/examples/shadcn/src/full-customization/full-customization.css
@@ -0,0 +1,750 @@
+/**
+ * Copyright 2025 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Full customization demo, shadcn edition. The screens are built from this example's shadcn/ui
+ * components and only the auth logic comes from @firebase-oss/ui-react. Each theme is a set of
+ * shadcn variables (--primary, --secondary, --radius, ...) taken from the "Firebase auth flows"
+ * Figma file (web Landing frames 20:6031, 20:7310 and 20:6675), plus a few --fc-* extras for what
+ * shadcn has no token for, such as hard offset shadows and per-theme fonts.
+ *
+ * The theme is set on (data-fc-theme) rather than the demo root, so shadcn's portalled
+ * pieces, the reauth dialog and the country picker menu, pick it up too.
+ */
+
+@import url("https://fonts.googleapis.com/css2?family=Bagel+Fat+One&family=Chivo+Mono:wght@500&family=JetBrains+Mono:wght@400;500&family=Onest:wght@500;700&family=Roboto+Mono:wght@500&family=Roboto:wght@500;600&family=Rowdies:wght@300;400&display=swap");
+@import url("https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400..700,0..1,0&icon_names=alternate_email,arrow_back,coffee,dark_mode,light_mode,lock,palette,person,phone,visibility,visibility_off&display=block");
+
+/* Doggo: Figma 20:6031 */
+body[data-fc-theme="doggo"] {
+ --background: #fff8f8;
+ --foreground: #211a1d;
+ --card: #fff8f8;
+ --card-foreground: #211a1d;
+ --popover: #ffffff;
+ --popover-foreground: #211a1d;
+ --primary: #864b6f;
+ --primary-foreground: #ffffff;
+ --secondary: #ffd8eb;
+ --secondary-foreground: #7b3b73;
+ --muted: #f9eaef;
+ --muted-foreground: #a08b95;
+ --accent: #ffd8eb;
+ --accent-foreground: #7b3b73;
+ --destructive: #ba1a1a;
+ --border: #d3c2c9;
+ --input: #d3c2c9;
+ --ring: #4c8bff;
+ --radius: 24px;
+
+ --fc-page-art: radial-gradient(1019px 1177px at 50% 53%, #fff8f8 4%, #ffddb4 34%, #ffd8eb 74%);
+ --fc-main-top: 271px;
+ --fc-font: 500 16px/24px "Onest", sans-serif;
+ --fc-prompt-font: 500 16px/24px "Onest", sans-serif;
+ --fc-prompt-align: center;
+ --fc-link: var(--primary);
+ --fc-card-padding: 16px;
+ --fc-card-shadow: 3px 6px 0 #ffd8eb;
+ --fc-actions-gap: 16px;
+ --fc-actions-justify: center;
+ --fc-field-bg: #ffffff;
+ --fc-field-border-width: 1px;
+ --fc-field-icon-fill: 0;
+ --fc-field-icon-weight: 700;
+ --fc-button-width: 327px;
+ --fc-button-radius: 36px;
+ --fc-button-font: 700 20px/20px "Onest", sans-serif;
+ --fc-button-border: 0 solid transparent;
+ --fc-button-shadow: 2px 4px 0 #5d0b47;
+ --fc-footer-font: 500 16px/24px "Onest", sans-serif;
+ --fc-footer-color: var(--muted-foreground);
+ --fc-provider-radius: 80px;
+ --fc-provider-font: 500 14px/20px "Roboto", sans-serif;
+ --fc-provider-phone-bg: #894680;
+ --fc-provider-phone-color: #ffffff;
+ --fc-provider-guest-color: #202124;
+ --fc-provider-guest-border: 2px solid #81737c;
+}
+
+/* Grid: Figma 20:7310 */
+body[data-fc-theme="grid"] {
+ --background: #f3fbfb;
+ --foreground: #2c1067;
+ --card: transparent;
+ --card-foreground: #2c1067;
+ --popover: #ffffff;
+ --popover-foreground: #2c1067;
+ --primary: #ff52b3;
+ --primary-foreground: #2c1067;
+ --secondary: #ffffff;
+ --secondary-foreground: #2c1067;
+ --muted: #e6f9f9;
+ --muted-foreground: #2c1067;
+ --accent: #00dce2;
+ --accent-foreground: #2c1067;
+ --destructive: #ba1a1a;
+ --border: #00dce2;
+ --input: #00dce2;
+ --ring: #ff52b3;
+ --radius: 16px;
+
+ --fc-page-art: none;
+ --fc-main-top: 397px;
+ --fc-font: 500 16px/24px "Roboto Mono", monospace;
+ --fc-prompt-font: 300 22px/31px "Rowdies", sans-serif;
+ --fc-prompt-align: left;
+ --fc-link: var(--foreground);
+ --fc-card-padding: 0;
+ --fc-card-shadow: none;
+ /* The Figma text-field instance is 64px tall around the 56px field, so the gap reads as 48px. */
+ --fc-actions-gap: 48px;
+ --fc-actions-justify: center;
+ --fc-field-bg: #ffffff;
+ --fc-field-border-width: 2px;
+ --fc-field-icon-fill: 1;
+ --fc-field-icon-weight: 400;
+ --fc-button-width: 332px;
+ --fc-button-radius: 24px;
+ --fc-button-font: 400 32px/20px "Rowdies", sans-serif;
+ --fc-button-border: 2px solid #00dce2;
+ --fc-button-shadow: 3px 6px 0 #00dce2;
+ --fc-footer-font: 500 16px/24px "JetBrains Mono", monospace;
+ --fc-footer-color: #000000;
+ --fc-provider-radius: 12px;
+ --fc-provider-font: 500 14px/20px "JetBrains Mono", monospace;
+ --fc-provider-phone-font: 500 14px/20px "Chivo Mono", monospace;
+ --fc-provider-phone-bg: #00dce2;
+ --fc-provider-phone-color: #2c1067;
+ --fc-provider-guest-color: #ff52b3;
+ --fc-provider-guest-border: 2px solid #ff52b3;
+}
+
+/* Coffee Spark: Figma 20:6675 */
+body[data-fc-theme="spark"] {
+ --background: #f1f1f1;
+ --foreground: #1f1f1f;
+ --card: transparent;
+ --card-foreground: #1f1f1f;
+ --popover: #fdfcfb;
+ --popover-foreground: #1f1f1f;
+ --primary: #fdadee;
+ --primary-foreground: #2c1067;
+ --secondary: #fdfcfb;
+ --secondary-foreground: #2c1067;
+ --muted: #e8e8e8;
+ --muted-foreground: #1f1f1f;
+ --accent: #fdadee;
+ --accent-foreground: #2c1067;
+ --destructive: #ba1a1a;
+ --border: #000000;
+ --input: #000000;
+ --ring: #fdadee;
+ --radius: 20px;
+
+ --fc-page-art: none;
+ --fc-main-top: 186px;
+ --fc-font: 500 16px/24px "JetBrains Mono", monospace;
+ --fc-prompt-font: 400 22px/31px "JetBrains Mono", monospace;
+ --fc-prompt-align: left;
+ --fc-link: var(--foreground);
+ --fc-card-padding: 0;
+ --fc-card-shadow: none;
+ --fc-actions-gap: 40px;
+ --fc-actions-justify: flex-end;
+ --fc-field-bg: #fdfcfb;
+ --fc-field-border-width: 2px;
+ --fc-field-icon-fill: 1;
+ --fc-field-icon-weight: 400;
+ --fc-button-width: 332px;
+ --fc-button-radius: 48px;
+ --fc-button-font: 500 24px/20px "JetBrains Mono", monospace;
+ --fc-button-border: 2px solid #000000;
+ --fc-button-shadow: none;
+ --fc-footer-font: 500 16px/24px "JetBrains Mono", monospace;
+ --fc-footer-color: #000000;
+ --fc-provider-radius: 80px;
+ --fc-provider-font: 500 14px/20px "JetBrains Mono", monospace;
+ --fc-provider-phone-bg: #c6ff00;
+ --fc-provider-phone-color: #34a853;
+ --fc-provider-guest-color: #202124;
+ --fc-provider-guest-border: 2px solid #81737c;
+}
+
+body[data-fc-theme] {
+ font: var(--fc-font);
+}
+
+/* Layout */
+
+.fc-root {
+ position: relative;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ min-height: 100dvh;
+ overflow: hidden;
+ background: var(--fc-page-art), var(--background);
+ color: var(--foreground);
+}
+
+/* Background art is placed on a 1440x1024 canvas, the size of the Figma frames, centred on the page. */
+.fc-art {
+ position: absolute;
+ top: 0;
+ left: 50%;
+ width: 1440px;
+ height: 1024px;
+ transform: translateX(-50%);
+ pointer-events: none;
+}
+
+.fc-art img {
+ position: absolute;
+ max-width: none;
+}
+
+/*
+ * --fc-main-top is where the first element sits in the 1024px tall Figma frame. Taller or shorter
+ * windows move the content by half the difference, so it stays centred like the design.
+ */
+.fc-main {
+ position: relative;
+ display: flex;
+ flex: 1;
+ flex-direction: column;
+ width: 100%;
+ max-width: calc(592px + 32px);
+ padding: max(80px, calc((100dvh - 1024px) / 2 + var(--fc-main-top))) 16px 48px;
+}
+
+.fc-icon {
+ font-family: "Material Symbols Outlined";
+ font-size: 24px;
+ font-weight: 500;
+ line-height: 1;
+ font-variation-settings: "FILL" 0;
+ user-select: none;
+}
+
+/* Brand, shown above the content. Only one theme draws each piece; the title stays readable by screen readers in all of them. */
+
+.fc-mascot,
+.fc-headline {
+ display: none;
+}
+
+.fc-intro {
+ position: absolute;
+ width: 1px;
+ height: 1px;
+ margin: 0;
+ overflow: hidden;
+ clip-path: inset(50%);
+ white-space: nowrap;
+}
+
+[data-fc-theme="doggo"] .fc-mascot {
+ position: relative;
+ z-index: 1;
+ display: block;
+ width: 177px;
+ height: 118px;
+ margin: 0 auto -11px;
+}
+
+[data-fc-theme="doggo"] .fc-intro {
+ position: static;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: auto;
+ height: auto;
+ overflow: visible;
+ clip-path: none;
+ white-space: normal;
+ margin: 0 0 4px;
+ padding: 16px 8px;
+ border-radius: 80px;
+ background: #4c8bff;
+ box-shadow: 0 0 0 4px #4c8bff;
+ font: 400 36px/44px "Bagel Fat One", sans-serif;
+ text-align: center;
+}
+
+.fc-intro__text {
+ background: radial-gradient(farthest-corner at 0% 0%, #fff8f8 4%, #ffddb4 34%, #ffd8eb 74%);
+ background-clip: text;
+ color: transparent;
+}
+
+[data-fc-theme="spark"] .fc-headline {
+ display: flex;
+ align-self: center;
+ align-items: center;
+ gap: 10px;
+ height: 48px;
+ margin-bottom: clamp(40px, calc(100dvh - 857px), 167px);
+ padding: 0 16px;
+ border-radius: 24px;
+ background: #ffffff;
+ color: #1c1b1b;
+ font: 500 20px/40px "JetBrains Mono", monospace;
+}
+
+/* Card: shadcn Card, reshaped to the Figma "email" frame */
+
+.fc-card {
+ display: flex;
+ flex-direction: column;
+ gap: 16px;
+ padding: var(--fc-card-padding);
+ border: 0;
+ border-radius: var(--radius);
+ background: var(--card);
+ box-shadow: var(--fc-card-shadow);
+}
+
+.fc-form {
+ display: flex;
+ flex-direction: column;
+ gap: 16px;
+}
+
+.fc-prompt {
+ margin: 0;
+ color: var(--muted-foreground);
+ font: var(--fc-prompt-font);
+ text-align: var(--fc-prompt-align);
+}
+
+.fc-body {
+ margin: 0;
+ color: var(--muted-foreground);
+}
+
+.fc-error {
+ margin: 0;
+ color: var(--destructive);
+ font-size: 14px;
+}
+
+.fc-row {
+ display: flex;
+ gap: 16px;
+}
+
+.fc-row > * {
+ flex: 1 1 0;
+ min-width: 0;
+}
+
+.fc-row > .fc-row__country {
+ flex: 0 0 128px;
+}
+
+/* Text field: shadcn Input inside a shell that adds the Figma "text-field" leading icon slot */
+
+.fc-field {
+ position: relative;
+}
+
+.fc-field__icon {
+ position: absolute;
+ top: 50%;
+ left: 12px;
+ color: var(--muted-foreground);
+ font-variation-settings: "FILL" var(--fc-field-icon-fill);
+ font-weight: var(--fc-field-icon-weight);
+ transform: translateY(-50%);
+ pointer-events: none;
+}
+
+.fc-input,
+.fc-select {
+ height: 56px;
+ padding-inline: 16px;
+ border-width: var(--fc-field-border-width);
+ border-radius: var(--radius);
+ background: var(--fc-field-bg);
+ color: var(--foreground);
+ font: inherit;
+ box-shadow: none;
+}
+
+/* shadcn's focus ring is a box-shadow, which the rule above clears, so draw one in the theme's ring colour. */
+.fc-input:focus-visible,
+.fc-select:focus-visible {
+ border-color: var(--ring);
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 50%, transparent);
+}
+
+.fc-field:has(.fc-field__icon) .fc-input {
+ padding-left: 48px;
+}
+
+.fc-field:has(.fc-field__toggle) .fc-input {
+ padding-right: 48px;
+}
+
+.fc-field__toggle {
+ position: absolute;
+ top: 50%;
+ right: 8px;
+ display: grid;
+ place-items: center;
+ width: 40px;
+ height: 40px;
+ border: 0;
+ border-radius: 50%;
+ background: transparent;
+ color: var(--muted-foreground);
+ transform: translateY(-50%);
+ cursor: pointer;
+}
+
+/* Verification code: shadcn InputOTP, one slot per digit */
+
+.fc-otp [data-slot="input-otp-group"] {
+ gap: 8px;
+}
+
+.fc-otp [data-slot="input-otp-slot"] {
+ width: 56px;
+ height: 56px;
+ border-width: var(--fc-field-border-width);
+ border-radius: var(--radius);
+ background: var(--fc-field-bg);
+ font-size: 24px;
+}
+
+/* Buttons: shadcn Button, 80px tall with a zero-blur offset shadow, Figma component "button" */
+
+.fc-actions {
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: var(--fc-actions-justify);
+ gap: 16px;
+ margin-top: calc(var(--fc-actions-gap) - 16px);
+}
+
+.fc-actions--stacked .fc-button {
+ flex-basis: 100%;
+ max-width: none;
+}
+
+.fc-button {
+ flex: 1 1 0;
+ min-width: min(100%, 240px);
+ max-width: var(--fc-button-width);
+ height: 80px;
+ padding: 10px 24px;
+ border: var(--fc-button-border);
+ border-radius: var(--fc-button-radius);
+ box-shadow: var(--fc-button-shadow);
+ font: var(--fc-button-font);
+ transition:
+ transform 120ms ease,
+ box-shadow 120ms ease;
+}
+
+.fc-button:active:not(:disabled) {
+ transform: translate(1px, 2px);
+ box-shadow: none;
+}
+
+/* The button's border and offset shadow replace shadcn's focus ring, so keyboard focus gets an outline. */
+.fc-button:focus-visible,
+.fc-link:focus-visible,
+.fc-provider:focus-visible,
+.fc-theme-switcher button:focus-visible {
+ outline: 3px solid var(--ring);
+ outline-offset: 3px;
+}
+
+.fc-links {
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: space-between;
+ gap: 8px 16px;
+}
+
+.fc-link {
+ height: auto;
+ padding: 0;
+ color: var(--fc-link);
+ font: inherit;
+ text-decoration: underline;
+ text-underline-offset: 3px;
+}
+
+.fc-link:disabled {
+ opacity: 0.6;
+ text-decoration: none;
+}
+
+/* Other sign in methods: Figma frame "Content" */
+
+.fc-footer {
+ position: relative;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 24px;
+ width: 100%;
+ padding: 24px 16px 74px;
+}
+
+.fc-footer__label {
+ margin: 0;
+ color: var(--fc-footer-color);
+ font: var(--fc-footer-font);
+}
+
+.fc-providers {
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: center;
+ gap: 24px;
+}
+
+.fc-provider {
+ height: 52px;
+ padding: 16px;
+ gap: 12px;
+ border: 1px solid #000000;
+ border-radius: var(--fc-provider-radius);
+ background: #ffffff;
+ color: #000000;
+ font: 600 14px/20px "Roboto", sans-serif;
+ letter-spacing: 0.1px;
+}
+
+.fc-provider:hover {
+ background: #ffffff;
+ color: #000000;
+}
+
+.fc-provider svg {
+ width: 20px;
+ height: 20px;
+}
+
+.fc-provider[data-provider="phone"] {
+ border: 0;
+ background: var(--fc-provider-phone-bg);
+ color: var(--fc-provider-phone-color);
+ font: var(--fc-provider-phone-font, var(--fc-provider-font));
+}
+
+.fc-provider[data-provider="guest"] {
+ border: var(--fc-provider-guest-border);
+ background: transparent;
+ color: var(--fc-provider-guest-color);
+ font: var(--fc-provider-font);
+}
+
+/* Lists (enrolled factors) */
+
+.fc-list {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ margin: 0;
+ padding: 0;
+ list-style: none;
+}
+
+.fc-list li {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 16px;
+ min-height: 48px;
+ padding: 8px 16px;
+ border: var(--fc-field-border-width) solid var(--border);
+ border-radius: var(--radius);
+ background: var(--fc-field-bg);
+}
+
+.fc-qr {
+ align-self: center;
+ width: 200px;
+ height: 200px;
+ padding: 12px;
+ border: 1px solid var(--border);
+ border-radius: var(--radius);
+ background: #ffffff;
+}
+
+.fc-secret {
+ margin: 0;
+ text-align: center;
+ word-break: break-all;
+ user-select: all;
+}
+
+/* Reauthentication: shadcn Dialog */
+
+.fc-dialog {
+ gap: 16px;
+ border-radius: var(--radius);
+ box-shadow: var(--fc-card-shadow);
+}
+
+/* Theme switcher and exit link, outside the themed design */
+
+.fc-theme-switcher {
+ position: fixed;
+ z-index: 10;
+ top: 16px;
+ right: 16px;
+ display: flex;
+ align-items: center;
+ gap: 4px;
+ padding: 4px;
+ border: 1px solid rgb(0 0 0 / 12%);
+ border-radius: 999px;
+ background: rgb(255 255 255 / 85%);
+ backdrop-filter: blur(8px);
+ font: 500 13px/20px system-ui, sans-serif;
+}
+
+.fc-theme-switcher > .fc-icon {
+ padding: 0 4px 0 8px;
+ color: #444444;
+ font-size: 20px;
+}
+
+.fc-theme-switcher button {
+ padding: 6px 12px;
+ border: 0;
+ border-radius: 999px;
+ background: transparent;
+ color: #444444;
+ font: inherit;
+ cursor: pointer;
+}
+
+.fc-theme-switcher button[aria-pressed="true"] {
+ background: #1f1f1f;
+ color: #ffffff;
+}
+
+.fc-theme-switcher button.fc-theme-switcher__mode {
+ display: grid;
+ place-items: center;
+ padding: 6px 8px;
+}
+
+.fc-theme-switcher__mode .fc-icon {
+ font-size: 18px;
+}
+
+.fc-exit {
+ position: fixed;
+ z-index: 10;
+ top: 16px;
+ left: 16px;
+ display: inline-flex;
+ align-items: center;
+ gap: 4px;
+ padding: 8px 14px 8px 10px;
+ border: 1px solid rgb(0 0 0 / 12%);
+ border-radius: 999px;
+ background: rgb(255 255 255 / 85%);
+ backdrop-filter: blur(8px);
+ color: #444444;
+ font: 500 13px/20px system-ui, sans-serif;
+ text-decoration: none;
+}
+
+.fc-exit .fc-icon {
+ font-size: 18px;
+}
+
+.fc-label--short {
+ display: none;
+}
+
+@media (max-width: 640px) {
+ .fc-main {
+ padding-top: 80px;
+ }
+
+ [data-fc-theme="doggo"] .fc-intro {
+ font-size: 28px;
+ line-height: 36px;
+ }
+
+ .fc-row {
+ flex-direction: column;
+ }
+
+ .fc-row > .fc-row__country {
+ flex-basis: auto;
+ }
+
+ /* Six code boxes fit the reauth dialog on a 360px phone. */
+ .fc-dialog {
+ padding: 16px;
+ }
+
+ .fc-dialog .fc-otp [data-slot="input-otp-group"] {
+ gap: 6px;
+ }
+
+ .fc-dialog .fc-otp [data-slot="input-otp-slot"] {
+ width: 40px;
+ }
+
+ .fc-button {
+ flex-basis: 100%;
+ max-width: none;
+ }
+
+ .fc-otp [data-slot="input-otp-slot"] {
+ width: 44px;
+ }
+
+ /* Stay clear of the back button, scrolling as a last resort. */
+ .fc-theme-switcher {
+ max-width: calc(100vw - 80px);
+ overflow-x: auto;
+ scrollbar-width: none;
+ }
+
+ .fc-theme-switcher button {
+ flex: none;
+ padding: 6px 7px;
+ }
+
+ .fc-label--long {
+ display: none;
+ }
+
+ .fc-label--short {
+ display: inline;
+ }
+
+ .fc-theme-switcher > .fc-icon,
+ .fc-exit__label {
+ display: none;
+ }
+
+ .fc-exit {
+ padding: 8px;
+ }
+}
diff --git a/examples/shadcn/src/full-customization/index.tsx b/examples/shadcn/src/full-customization/index.tsx
new file mode 100644
index 000000000..1dd0f83b1
--- /dev/null
+++ b/examples/shadcn/src/full-customization/index.tsx
@@ -0,0 +1,127 @@
+/**
+ * Copyright 2025 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { useEffect, useState, type ReactElement } from "react";
+import { Link, Navigate, Route, Routes } from "react-router";
+import type { User } from "firebase/auth";
+import { completeEmailLinkSignIn } from "@firebase-oss/ui-core";
+import { useMultiFactorAssertionCleanup, useUI } from "@firebase-oss/ui-react";
+
+import { useUser } from "@/firebase/hooks";
+import "./full-customization.css";
+import { DemoProvider, paths } from "./state";
+import { ProAccount } from "./professional/account";
+import { ProMfaChallengeStep } from "./professional/mfa-challenge";
+import { ProMfaEnrollment } from "./professional/mfa-enrollment";
+import { ProPhone } from "./professional/phone";
+import { ProEmailLink, ProResetPassword, ProSignIn, ProSignUp } from "./professional/sign-in";
+import { ThemeArt, ThemeIdContext, ThemeSwitcher, useTheme } from "./theme";
+import { AccountStep } from "./steps/account";
+import { EmailEntryStep } from "./steps/email-entry";
+import { LoginStep } from "./steps/login";
+import { MfaChallengeStep } from "./steps/mfa-challenge";
+import { MfaEnrollmentStep } from "./steps/mfa-enrollment";
+import { PhoneStep } from "./steps/phone";
+import { SignUpStep } from "./steps/sign-up";
+
+/** Owns the sign-in resolver, so switching theme mid-challenge swaps the screen without cancelling the sign in. */
+function SignInChallenge({ children }: { children: ReactElement }) {
+ useMultiFactorAssertionCleanup();
+ return children;
+}
+
+/**
+ * A complete sign in flow with its own UI, where FirebaseUI supplies only the auth logic through
+ * the ui-react action hooks. Sign in state drives the routing: a signed-in user is sent to the
+ * account page, and a pending multi-factor challenge takes over whichever screen raised it.
+ */
+export default function FullCustomizationDemo() {
+ const ui = useUI();
+ const user = useUser();
+ const [theme, setTheme] = useTheme();
+
+ // Completes sign in when the page is opened from a link sent by "Send login link". The ui-react hook for this
+ // drops failures, so the demo calls core directly and shows an expired or used link on the login screen.
+ const [linkError, setLinkError] = useState(null);
+ useEffect(() => {
+ completeEmailLinkSignIn(ui, window.location.href).catch((error) =>
+ setLinkError(error instanceof Error ? error.message : String(error))
+ );
+ // Runs once on mount, like useEmailLinkAuthFormCompleteSignIn; ui is deliberately not a dependency.
+ }, []);
+
+ const signedOut = (step: ReactElement) => (user ? : step);
+ const signedIn = (step: (user: User) => ReactElement) => (user ? step(user) : );
+
+ // Professional brings its own screens; the other themes share one set and differ only in styling.
+ const pro = theme === "professional";
+ const screens = pro
+ ? {
+ email: ,
+ login: ,
+ signUp: ,
+ phone: ,
+ resetPassword: ,
+ emailLink: ,
+ account: (u: User) => ,
+ twoFactor: (u: User) => ,
+ challenge: ,
+ }
+ : {
+ email: ,
+ login: ,
+ signUp: ,
+ phone: ,
+ resetPassword: ,
+ emailLink: ,
+ account: (u: User) => ,
+ twoFactor: (u: User) => ,
+ challenge: ,
+ };
+
+ return (
+
+
+
+
+
+ arrow_back
+
+ All examples
+
+
+
+ {/* A signed-in user with a resolver is reauthenticating; the reauth dialog completes that one. */}
+ {ui.multiFactorResolver && !user ? (
+ {screens.challenge}
+ ) : (
+
+
+
+
+
+
+
+
+
+ } />
+
+ )}
+
+
+
+ );
+}
diff --git a/examples/shadcn/src/full-customization/professional/account.tsx b/examples/shadcn/src/full-customization/professional/account.tsx
new file mode 100644
index 000000000..54e064124
--- /dev/null
+++ b/examples/shadcn/src/full-customization/professional/account.tsx
@@ -0,0 +1,183 @@
+/**
+ * Copyright 2025 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { useEffect, useReducer, useState } from "react";
+import { useNavigate } from "react-router";
+import {
+ EmailAuthProvider,
+ multiFactor,
+ onIdTokenChanged,
+ sendEmailVerification,
+ signOut,
+ updatePassword,
+ type User,
+} from "firebase/auth";
+import { KeyRound, Mail, ShieldCheck, User as UserIcon } from "lucide-react";
+import { useUI } from "@firebase-oss/ui-react";
+
+import { useAuthTask } from "../components";
+import { paths } from "../state";
+import { useReauth } from "../reauth";
+import { ProButton, ProError, ProField, ProGroup, ProHeader, ProRow, ProSection, ProSeparator } from "./kit";
+
+function signedInWith(user: User) {
+ if (user.isAnonymous) return "a temporary account";
+ const provider = user.providerData[0]?.providerId;
+ if (provider === "google.com") return "Google";
+ if (provider === "phone") return "phone";
+ return "email";
+}
+
+/** A settings-style account page, as in the Android and iOS demos. */
+export function ProAccount({ user }: { user: User }) {
+ const ui = useUI();
+ const navigate = useNavigate();
+ const { withReauth, dialog } = useReauth();
+ const [editingPassword, setEditingPassword] = useState(false);
+ const [newPassword, setNewPassword] = useState("");
+ const [message, setMessage] = useState(null);
+ const [verificationSent, setVerificationSent] = useState(false);
+ const task = useAuthTask();
+
+ // The user object is mutated in place by reload() and profile updates, so re-render on demand and on token refresh.
+ const [, refresh] = useReducer((n: number) => n + 1, 0);
+ useEffect(() => onIdTokenChanged(ui.auth, () => refresh()), [ui.auth]);
+
+ const identity = user.displayName || user.email || user.phoneNumber;
+ const hasPassword = user.providerData.some((p) => p.providerId === EmailAuthProvider.PROVIDER_ID);
+ const twoFactorOn = multiFactor(user).enrolledFactors.length > 0;
+ const needsVerification = Boolean(user.email) && !user.emailVerified;
+
+ return (
+
+
+
+ {dialog}
+
+ );
+}
diff --git a/examples/shadcn/src/full-customization/professional/kit.tsx b/examples/shadcn/src/full-customization/professional/kit.tsx
new file mode 100644
index 000000000..75e745a25
--- /dev/null
+++ b/examples/shadcn/src/full-customization/professional/kit.tsx
@@ -0,0 +1,374 @@
+/**
+ * Copyright 2025 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { useContext, useId, useState, type ComponentProps, type ComponentType, type ReactNode } from "react";
+import { ChevronLeft, ChevronRight, CircleAlert, Eye, EyeOff, Shield } from "lucide-react";
+import type { CountryData } from "@firebase-oss/ui-core";
+import { PolicyContext, useCountries } from "@firebase-oss/ui-react";
+
+import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
+
+import "./professional.css";
+
+type Icon = ComponentType<{ className?: string }>;
+
+type ProPageProps = {
+ title: string;
+ subtitle?: ReactNode;
+ /** A header icon tile, shown above the title. */
+ icon?: Icon;
+ /** The brand row, shown on the first screen only. */
+ brand?: boolean;
+ onBack?: () => void;
+ children: ReactNode;
+ footer?: ReactNode;
+};
+
+/** A flat, left-aligned page: header, content, then a footer pinned to the bottom when content is short. */
+export function ProPage({ title, subtitle, icon, brand, onBack, children, footer }: ProPageProps) {
+ return (
+
+ {onBack && }
+
+
Verify {user.email} to set up two-factor authentication.
}
+ {task.error}
+ {message && (
+
+ {message}
+
+ )}
+
+ {needsVerification ? (
+
+ task.run(() => sendEmailVerification(user).then(() => setMessage("Verification email sent.")))
+ }
+ >
+ Send verification email
+
+ ) : null}
+ {needsVerification ? (
+
+ task.run(async () => {
+ await user.reload();
+ refresh();
+ })
+ }
+ >
+ I've verified my email
+
+ ) : (
+ navigate(paths.twoFactor)}>
+ {enrolledFactors > 0 ? "Manage two-factor" : "Set up two-factor"}
+
+ )}
+
+ {signOutButton}
+ {dialog}
+
+ );
+}
diff --git a/examples/shadcn/src/full-customization/steps/email-entry.tsx b/examples/shadcn/src/full-customization/steps/email-entry.tsx
new file mode 100644
index 000000000..6efc017b5
--- /dev/null
+++ b/examples/shadcn/src/full-customization/steps/email-entry.tsx
@@ -0,0 +1,87 @@
+/**
+ * Copyright 2025 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { useMemo } from "react";
+import { useNavigate } from "react-router";
+import { GoogleAuthProvider } from "firebase/auth";
+import { signInAnonymously } from "@firebase-oss/ui-core";
+import { useEmailLinkAuthFormSchema, useSignInWithProvider, useUI } from "@firebase-oss/ui-react";
+
+import { Actions, Button, ErrorText, Page, ProviderButton, TextField, useAuthTask } from "../components";
+import { paths, useDemo } from "../state";
+
+/** The landing screen from the web Figma frames: one email field, then the chosen next step. */
+export function EmailEntryStep() {
+ const ui = useUI();
+ const navigate = useNavigate();
+ const { email, setEmail } = useDemo();
+ const emailSchema = useEmailLinkAuthFormSchema();
+ const isValidEmail = emailSchema.safeParse({ email }).success;
+
+ const google = useMemo(() => new GoogleAuthProvider(), []);
+ const { callback: signInWithGoogle, error: googleError } = useSignInWithProvider(google);
+ const guest = useAuthTask();
+ const busy = ui.state !== "idle";
+
+ return (
+
+
Other sign in methods
+
+
+ Sign in with Google
+
+ navigate(paths.phone)} disabled={busy}>
+ Sign in with phone
+
+ guest.run(() => signInAnonymously(ui))} disabled={busy}>
+ Sign in as a guest
+
+
+ {googleError ?? guest.error}
+
+ }
+ >
+
+
+ );
+}
diff --git a/examples/shadcn/src/full-customization/steps/login.tsx b/examples/shadcn/src/full-customization/steps/login.tsx
new file mode 100644
index 000000000..f34ad922f
--- /dev/null
+++ b/examples/shadcn/src/full-customization/steps/login.tsx
@@ -0,0 +1,106 @@
+/**
+ * Copyright 2025 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { useState } from "react";
+import { useNavigate } from "react-router";
+import {
+ useEmailLinkAuthFormAction,
+ useEmailLinkAuthFormSchema,
+ useForgotPasswordAuthFormAction,
+ useSignInAuthFormAction,
+} from "@firebase-oss/ui-react";
+
+import { Actions, Button, ErrorText, Links, Page, TextField, TextLink, useAuthTask } from "../components";
+import { paths, useDemo } from "../state";
+
+/**
+ * Password sign in, with the password reset and email link modes inline, as in the Android demo.
+ * Signing in is picked up by the demo root, which moves to the account page or the MFA challenge.
+ */
+export function LoginStep() {
+ const navigate = useNavigate();
+ const { email, setEmail, linkError } = useDemo();
+ // Arriving here without an address (a refresh or a direct visit) makes the field editable.
+ const [emailLocked] = useState(email.length > 0);
+ const [password, setPassword] = useState("");
+ const [resetSent, setResetSent] = useState(false);
+ const [linkSent, setLinkSent] = useState(false);
+
+ const signIn = useSignInAuthFormAction();
+ const sendReset = useForgotPasswordAuthFormAction();
+ const sendLink = useEmailLinkAuthFormAction();
+ const emailSchema = useEmailLinkAuthFormSchema();
+ const task = useAuthTask();
+
+ // Both links need an address. Rather than disabling them silently, say what is missing.
+ const withEmail = (send: () => Promise) => () => {
+ const result = emailSchema.safeParse({ email });
+ if (!result.success) {
+ task.setError(result.error.issues[0]?.message ?? null);
+ return;
+ }
+ void task.run(send);
+ };
+
+ return (
+
+
+
+ );
+}
diff --git a/examples/shadcn/src/full-customization/steps/mfa-challenge.tsx b/examples/shadcn/src/full-customization/steps/mfa-challenge.tsx
new file mode 100644
index 000000000..f28251ec2
--- /dev/null
+++ b/examples/shadcn/src/full-customization/steps/mfa-challenge.tsx
@@ -0,0 +1,181 @@
+/**
+ * Copyright 2025 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { useState, type ReactNode } from "react";
+import { FactorId, type MultiFactorInfo, type PhoneMultiFactorInfo } from "firebase/auth";
+import {
+ useSmsMultiFactorAssertionPhoneFormAction,
+ useSmsMultiFactorAssertionVerifyFormAction,
+ useTotpMultiFactorAssertionFormAction,
+ useUI,
+} from "@firebase-oss/ui-react";
+
+import {
+ Actions,
+ Button,
+ CodeForm,
+ ErrorText,
+ Links,
+ Page,
+ TextLink,
+ useAuthTask,
+ useResettableRecaptcha,
+} from "../components";
+
+/** Wraps the challenge in its surroundings: a full page for sign in, the dialog for reauthentication. */
+type Frame = (prompt: string, body: ReactNode) => ReactNode;
+
+type ChallengeProps = {
+ frame: Frame;
+ onCancel: () => void;
+ /** Called once the second factor is confirmed and the resolver is resolved. */
+ onResolved?: () => void;
+};
+
+/**
+ * Shown by the demo root whenever a sign in call leaves a multi-factor resolver on the UI state.
+ * Resolving it signs the user in; cancelling clears it and returns to the previous screen.
+ */
+export function MfaChallengeStep() {
+ const ui = useUI();
+ return (
+ (
+
+ {body}
+
+ )}
+ onCancel={() => ui.setMultiFactorResolver()}
+ />
+ );
+}
+
+/**
+ * Completes `ui.multiFactorResolver`, whichever call raised it. The ui-react assertion hooks only
+ * call `resolver.resolveSignIn`, so the same screens finish a reauthentication as well as a sign in.
+ */
+export function MfaChallenge({ frame, onCancel, onResolved }: ChallengeProps) {
+ const ui = useUI();
+ const hints = ui.multiFactorResolver?.hints ?? [];
+ const [hint, setHint] = useState(hints.length === 1 ? hints[0]! : null);
+
+ const links = (
+ <>
+ {hints.length > 1 && setHint(null)}>Pick a different method}
+ Cancel
+ >
+ );
+
+ if (!hint) {
+ return frame(
+ "Choose how to confirm it's you.",
+ <>
+
+ {hints.map((h, index) => (
+ setHint(h)}>
+ {h.factorId === FactorId.PHONE ? "Text message" : "Authenticator app"}
+
+ ))}
+
+
+ Cancel
+
+ >
+ );
+ }
+
+ return hint.factorId === FactorId.PHONE ? (
+
+ ) : (
+
+ );
+}
+
+type FactorProps = { hint: MultiFactorInfo; frame: Frame; links: ReactNode; onResolved?: () => void };
+
+function TotpChallenge({ hint, frame, links, onResolved }: FactorProps) {
+ const verify = useTotpMultiFactorAssertionFormAction();
+ const task = useAuthTask();
+
+ return frame(
+ "Open your authenticator app and enter the 6-digit code for this account.",
+ {
+ await verify({ hint, verificationCode });
+ onResolved?.();
+ }}
+ />
+ );
+}
+
+function SmsChallenge({ hint, frame, links, onResolved }: FactorProps) {
+ const recaptcha = useResettableRecaptcha();
+ const sendCode = useSmsMultiFactorAssertionPhoneFormAction();
+ const verify = useSmsMultiFactorAssertionVerifyFormAction();
+ const task = useAuthTask();
+ const [verificationId, setVerificationId] = useState(null);
+
+ const send = () => {
+ // The verifier is briefly null while a fresh one renders after each send.
+ const recaptchaVerifier = recaptcha.verifier;
+ if (!recaptchaVerifier) return;
+ return task.run(async () => {
+ try {
+ setVerificationId(await sendCode({ hint, recaptchaVerifier }));
+ } finally {
+ recaptcha.reset();
+ }
+ });
+ };
+
+ const body = verificationId ? (
+ {
+ await verify({ verificationId, verificationCode });
+ onResolved?.();
+ }}
+ links={
+ <>
+ void send()} disabled={task.pending || !recaptcha.verifier}>
+ Resend code
+
+ {links}
+ >
+ }
+ />
+ ) : (
+ <>
+
We'll send a code to confirm it's you.
+ {task.error}
+ {links}
+
+ void send()} disabled={!recaptcha.verifier} loading={task.pending}>
+ Send code
+
+
+ >
+ );
+
+ return (
+ <>
+ {frame(`Text message to ${(hint as PhoneMultiFactorInfo).phoneNumber}.`, body)}
+ {recaptcha.container}
+ >
+ );
+}
diff --git a/examples/shadcn/src/full-customization/steps/mfa-enrollment.tsx b/examples/shadcn/src/full-customization/steps/mfa-enrollment.tsx
new file mode 100644
index 000000000..fd8985a81
--- /dev/null
+++ b/examples/shadcn/src/full-customization/steps/mfa-enrollment.tsx
@@ -0,0 +1,249 @@
+/**
+ * Copyright 2025 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { useState, type ReactNode } from "react";
+import { useNavigate } from "react-router";
+import { FactorId, multiFactor, type TotpSecret, type User } from "firebase/auth";
+import { type CountryData, formatPhoneNumber, generateTotpQrCode } from "@firebase-oss/ui-core";
+import {
+ useDefaultCountry,
+ useMultiFactorEnrollmentVerifyPhoneNumberFormAction,
+ useMultiFactorEnrollmentVerifyTotpFormAction,
+ useSmsMultiFactorEnrollmentPhoneAuthFormAction,
+ useTotpMultiFactorSecretGenerationFormAction,
+ useUI,
+} from "@firebase-oss/ui-react";
+
+import {
+ Actions,
+ Button,
+ CodeForm,
+ ErrorText,
+ Links,
+ Page,
+ PhoneFields,
+ TextLink,
+ useAuthTask,
+ useResettableRecaptcha,
+} from "../components";
+import { paths } from "../state";
+import { useReauth } from "../reauth";
+
+type Step =
+ | { kind: "select" }
+ | { kind: "sms" }
+ | { kind: "sms-code"; verificationId: string; phoneNumber: string }
+ | { kind: "totp"; secret: TotpSecret };
+
+const REAUTH_REASON = "Verify your identity to change your two-factor settings.";
+
+export function MfaEnrollmentStep({ user }: { user: User }) {
+ const navigate = useNavigate();
+ const [step, setStep] = useState({ kind: "select" });
+ const { withReauth, dialog } = useReauth();
+ const generateSecret = useTotpMultiFactorSecretGenerationFormAction();
+ const task = useAuthTask();
+ const removal = useAuthTask();
+
+ const enrolled = multiFactor(user).enrolledFactors;
+ const back = setStep({ kind: "select" })}>Pick a different method;
+ const done = () => navigate(paths.account);
+
+ let content;
+ if (step.kind === "sms") {
+ content = (
+ setStep({ kind: "sms-code", verificationId, phoneNumber })}
+ />
+ );
+ } else if (step.kind === "sms-code") {
+ content = ;
+ } else if (step.kind === "totp") {
+ content = ;
+ } else {
+ content = (
+
+ {enrolled.length > 0 && (
+
+ {
+ await withReauth(REAUTH_REASON, () => verify({ secret, verificationCode, displayName: "Authenticator app" }));
+ onEnrolled();
+ }}
+ />
+
+ );
+}
diff --git a/examples/shadcn/src/full-customization/steps/phone.tsx b/examples/shadcn/src/full-customization/steps/phone.tsx
new file mode 100644
index 000000000..bfe8a2ab9
--- /dev/null
+++ b/examples/shadcn/src/full-customization/steps/phone.tsx
@@ -0,0 +1,108 @@
+/**
+ * Copyright 2025 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { useState } from "react";
+import { useNavigate } from "react-router";
+import { type CountryData, formatPhoneNumber } from "@firebase-oss/ui-core";
+import { useDefaultCountry, usePhoneNumberFormAction, useVerifyPhoneNumberFormAction } from "@firebase-oss/ui-react";
+
+import {
+ Actions,
+ Button,
+ CodeForm,
+ ErrorText,
+ Links,
+ Page,
+ PhoneFields,
+ TextLink,
+ useAuthTask,
+ useResettableRecaptcha,
+} from "../components";
+import { paths } from "../state";
+
+export function PhoneStep() {
+ const navigate = useNavigate();
+ const defaultCountry = useDefaultCountry();
+ const [country, setCountry] = useState(defaultCountry);
+ const [phone, setPhone] = useState("");
+ const [verificationId, setVerificationId] = useState(null);
+
+ // The reCAPTCHA container sits outside both steps so it survives the switch to the code step.
+ const recaptcha = useResettableRecaptcha();
+ const sendCode = usePhoneNumberFormAction();
+ const verifyCode = useVerifyPhoneNumberFormAction();
+ const task = useAuthTask();
+
+ const phoneNumber = formatPhoneNumber(phone, country);
+ const send = () => {
+ // The verifier is briefly null while a fresh one renders after each send.
+ const recaptchaVerifier = recaptcha.verifier;
+ if (!recaptchaVerifier) return;
+ return task.run(async () => {
+ try {
+ setVerificationId(await sendCode({ phoneNumber, recaptchaVerifier }));
+ } finally {
+ recaptcha.reset();
+ }
+ });
+ };
+
+ return (
+ <>
+ {verificationId ? (
+
+ verifyCode({ verificationId, verificationCode })}
+ links={
+ <>
+ void send()} disabled={task.pending || !recaptcha.verifier}>
+ Resend code
+
+ setVerificationId(null)}>Use a different number
+ >
+ }
+ />
+
+ ) : (
+
+
+
+ )}
+ {recaptcha.container}
+ >
+ );
+}
diff --git a/examples/shadcn/src/full-customization/steps/reauth.tsx b/examples/shadcn/src/full-customization/steps/reauth.tsx
new file mode 100644
index 000000000..df44a7c6b
--- /dev/null
+++ b/examples/shadcn/src/full-customization/steps/reauth.tsx
@@ -0,0 +1,89 @@
+/**
+ * Copyright 2025 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Dialog, DialogContent, DialogDescription, DialogTitle } from "@/components/ui/dialog";
+
+import { Actions, Button, ErrorText, Links, ProviderButton, TextField, TextLink } from "../components";
+import type { ReauthDialogProps, ReauthFlow } from "../reauth";
+import { MfaChallenge } from "./mfa-challenge";
+
+export function ThemedReauthDialog({ reason, onConfirmed, onCancel, flow }: ReauthDialogProps & { flow: ReauthFlow }) {
+ const { password, setPassword, secondFactor, task, hasPassword, hasGoogle } = flow;
+
+ return (
+
+ );
+}
diff --git a/examples/shadcn/src/full-customization/steps/sign-up.tsx b/examples/shadcn/src/full-customization/steps/sign-up.tsx
new file mode 100644
index 000000000..3ea23f9a7
--- /dev/null
+++ b/examples/shadcn/src/full-customization/steps/sign-up.tsx
@@ -0,0 +1,108 @@
+/**
+ * Copyright 2025 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { useState } from "react";
+import { useNavigate } from "react-router";
+import { updateProfile } from "firebase/auth";
+import { useSignUpAuthFormAction } from "@firebase-oss/ui-react";
+
+import { Actions, Button, ErrorText, Links, Page, TextField, TextLink, useAuthTask } from "../components";
+import { paths, useDemo } from "../state";
+
+export function SignUpStep() {
+ const navigate = useNavigate();
+ const { email, setEmail } = useDemo();
+ const [firstName, setFirstName] = useState("");
+ const [lastName, setLastName] = useState("");
+ const [password, setPassword] = useState("");
+ const [confirmPassword, setConfirmPassword] = useState("");
+
+ const signUp = useSignUpAuthFormAction();
+ const task = useAuthTask();
+
+ const mismatch = confirmPassword.length > 0 && password !== confirmPassword;
+ const complete = firstName.trim() && lastName.trim() && email && password && password === confirmPassword;
+
+ return (
+
+
+
+ );
+}
diff --git a/examples/shadcn/src/full-customization/theme.tsx b/examples/shadcn/src/full-customization/theme.tsx
new file mode 100644
index 000000000..40cc0512c
--- /dev/null
+++ b/examples/shadcn/src/full-customization/theme.tsx
@@ -0,0 +1,138 @@
+/**
+ * Copyright 2025 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { createContext, useContext, useLayoutEffect, useState } from "react";
+
+import doggoPattern from "./assets/doggo-pattern.svg";
+import gridPattern from "./assets/grid-pattern.svg";
+import sparkBlob from "./assets/spark-blob.webp";
+
+export const themes = [
+ { id: "doggo", label: "Doggo" },
+ { id: "spark", label: "Coffee Spark", short: "Spark" },
+ { id: "grid", label: "Grid" },
+ { id: "professional", label: "Professional" },
+] as const;
+
+export type ThemeId = (typeof themes)[number]["id"];
+
+/** The active theme, for the screens whose layout differs per theme (Professional has its own). */
+export const ThemeIdContext = createContext("doggo");
+
+export function useThemeId() {
+ return useContext(ThemeIdContext);
+}
+
+const STORAGE_KEY = "firebaseui:full-customization:theme";
+
+function readStoredTheme(): ThemeId {
+ try {
+ const stored = window.localStorage.getItem(STORAGE_KEY);
+ return themes.some((theme) => theme.id === stored) ? (stored as ThemeId) : "doggo";
+ } catch {
+ return "doggo";
+ }
+}
+
+export function useTheme() {
+ const [theme, setTheme] = useState(readStoredTheme);
+
+ // Set on before paint, so portalled components (Dialog, Select) are themed and nothing flashes.
+ useLayoutEffect(() => {
+ document.body.dataset.fcTheme = theme;
+ return () => {
+ delete document.body.dataset.fcTheme;
+ };
+ }, [theme]);
+
+ const changeTheme = (next: ThemeId) => {
+ setTheme(next);
+ try {
+ window.localStorage.setItem(STORAGE_KEY, next);
+ } catch {
+ // Storage can be unavailable (private mode), the switch still works for this visit.
+ }
+ };
+
+ return [theme, changeTheme] as const;
+}
+
+export function ThemeSwitcher({ theme, onChange }: { theme: ThemeId; onChange: (theme: ThemeId) => void }) {
+ return (
+
+ );
+}
+
+/** The example's light/dark toggle is hidden on this route, so Professional, which follows it, gets its own. */
+function DarkModeToggle() {
+ const [dark, setDark] = useState(() => document.documentElement.classList.contains("dark"));
+
+ return (
+ {
+ const next = !dark;
+ document.documentElement.classList.toggle("dark", next);
+ try {
+ window.localStorage.setItem("theme", next ? "dark" : "light");
+ } catch {
+ // Storage can be unavailable (private mode), the switch still works for this visit.
+ }
+ setDark(next);
+ }}
+ >
+
+ {dark ? "dark_mode" : "light_mode"}
+
+
+ );
+}
+
+/**
+ * Background art for each theme, positioned with the offsets of the matching layer in its Figma
+ * frame: "pattern" in 20:6031, "grid" in 20:7310 and "avatar spark" in 20:6675.
+ */
+export function ThemeArt({ theme }: { theme: ThemeId }) {
+ return (
+
+ );
+ }
+}
+
+// The full customization demo draws its own chrome, so the example-wide toggles stay out of its way.
+function GlobalToggles() {
+ const { pathname } = useLocation();
+ if (pathname.startsWith("/full-customization")) return null;
+
+ return (
+ <>
+
+
+ >
+ );
+}
+
function ThemeToggle() {
return (