> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Configure Auth0ComponentProvider

> Learn how Auth0ComponentProvider synchronizes authentication, internationalization, theming, toast notifications, and caching options.

> [!WARNING]
>
> **The Auth0 Universal Components feature is in [Early Access](/docs/docs/troubleshoot/product-lifecycle/product-release-stages).**
>
> To participate, contact Auth0 Support.
>
> By using this feature, you agree to the applicable Free Trial terms in Okta's [Master Subscription Agreement](https://www.okta.com/legal).

The `Auth0ComponentProvider` is the orchestration layer for [Auth0 Universal Components](/docs/docs/get-started/universal-components/universal-components-overview). Auth0 SDKs manage sessions and tokens, and the `Auth0ComponentProvider` translates that identity state into a functional, branded UI context. `Auth0ComponentProvider` makes sure components, such as MFA enrollment, have the necessary permissions, cached data, and styling.

## Benefits

`Auth0ComponentProvider` is the required root wrapper for all Auth0 Universal Components. Benefits to using the wrapper are:

* **Identity Alignment**: Bridges the gap between [Auth0 SDKs](/docs/docs/libraries) and the [My Account API](/docs/docs/manage-users/my-account-api) to ensure requests are signed with user-scoped tokens.
* **Performance Optimization**: Implements a shared **TanStack Query** cache specifically tuned for identity workflows to prevent redundant API calls and layout shifts.
* **Design System Consistency**: Propagates **Tailwind CSS** variables and **Shadcn**-compatible themes across the component tree.
* **Global Feedback**: Manages a unified toast notification system for security alerts and workflow status.

## Integration architecture

Nest `Auth0ComponentProvider` in your authentication provider (`Auth0Provider`). This configuration allows access to authentication state and token acquisition methods required to call Auth0 APIs.

## Configure `Auth0ComponentProvider`

> [tab] React
>
> **Security recommendation:** For production applications that manage Organization configuration, Auth0 recommends the [Next.js setup](/docs/docs/get-started/universal-components/auth0-component-provider#next-js) (Regular Web App). Next.js proxy mode stores tokens server-side, which reduces the attack surface compared to browser-stored tokens in a Single Page Application. If you use React SPA mode, review the [Token Storage](/docs/docs/secure/security-guidance/data-security/token-storage) guidance to understand the tradeoffs.
>
> ```tsx App.tsx theme={null}
> import { Auth0Provider } from "@auth0/auth0-react";
> import { Auth0ComponentProvider } from "@auth0/universal-components-react/spa";
>
> function App() {
>   return (
>     <Auth0Provider
>       domain="your-tenant.auth0.com"
>       clientId="YOUR_CLIENT_ID"
>       authorizationParams={{ redirect_uri: window.location.origin }}
>       interactiveErrorHandler='popup' // Required to handle step-up auth challenges via Universal Login popup
>     >
>       <Auth0ComponentProvider>
>         {/* Your app with Auth0 Universal Components */}
>       </Auth0ComponentProvider>
>     </Auth0Provider>
>   );
> }
> ```
>
> ### Token renewal
>
> By default, the Auth0 React SDK uses silent authentication to obtain new access tokens. If your application enables refresh-token renewal, configure refresh tokens for the Auth0 application and set `useRefreshTokens={true}` on `Auth0Provider`:
>
> ```tsx App.tsx theme={null}
> <Auth0Provider
>   domain="YOUR_TENANT.auth0.com"
>   clientId="YOUR_CLIENT_ID"
>   authorizationParams={{ redirect_uri: window.location.origin }}
>   useRefreshTokens={true}
> >
>   <Auth0ComponentProvider>
>     {/* Your app with Auth0 Universal Components */}
>   </Auth0ComponentProvider>
> </Auth0Provider>
> ```
>
> ### Use with My Organization components
>
> My Organization components request user-scoped access tokens for the My Organization API. They supply the required audience and scopes when making API requests.
>
> ***
>
> ## Properties
>
> <table>
>   <thead>
>     <tr>
>       <th>Property</th>
>       <th>Type</th>
>       <th>Required</th>
>       <th>Description</th>
>     </tr>
>   </thead>
>
>   <tbody>
>     <tr>
>       <td>`domain`</td>
>       <td>`string`</td>
>       <td>Yes</td>
>       <td>Auth0 tenant domain ("YOUR\_AUTH0\_TENANT.auth0.com").</td>
>     </tr>
>
>     <tr>
>       <td>`previewMode`</td>
>       <td>`boolean`</td>
>       <td>No</td>
>       <td>When `true`, skips API client initialization. Used for documentation previews and demos.</td>
>     </tr>
>
>     <tr>
>       <td>`i18n`</td>
>       <td>`I18nOptions`</td>
>       <td>No</td>
>       <td>Internationalization settings including currentLanguage and fallbackLanguage.</td>
>     </tr>
>
>     <tr>
>       <td>`themeSettings`</td>
>       <td>`ThemeSettings`</td>
>       <td>No</td>
>       <td>Theme configuration including mode (light/dark), theme variant (default/minimal/rounded), and CSS variables.</td>
>     </tr>
>
>     <tr>
>       <td>`toastSettings`</td>
>       <td>`ToastSettings`</td>
>       <td>No</td>
>       <td>Toast notification configuration including provider selection (sonner/custom), positioning, duration, and custom toast methods.</td>
>     </tr>
>
>     <tr>
>       <td>`cacheConfig`</td>
>       <td>`QueryCacheConfig`</td>
>       <td>No</td>
>       <td>Controls TanStack Query caching (two min stale / five min GC by default). Set `enabled: false` to force fresh data.</td>
>     </tr>
>
>     <tr>
>       <td>`loader`</td>
>       <td>`React.ReactNode`</td>
>       <td>No</td>
>       <td>Custom loading component to display during authentication initialization.</td>
>     </tr>
>   </tbody>
> </table>
>
> ***
>
> ## User experience
>
> ***
>
> **i18n**
>
> Use the following properties to align the Universal Components with your application's design system and locale.
>
> <table>
>   <thead>
>     <tr>
>       <th>Property</th>
>       <th>Type</th>
>       <th>Required</th>
>       <th>Default</th>
>       <th>Description</th>
>     </tr>
>   </thead>
>
>   <tbody>
>     <tr>
>       <td>
>         `currentLanguage`
>       </td>
>
>       <td>
>         `string`
>       </td>
>
>       <td>Yes</td>
>       <td>-</td>
>       <td>Current language code (for example, "en", "es", "fr")</td>
>     </tr>
>
>     <tr>
>       <td>
>         `fallbackLanguage`
>       </td>
>
>       <td>
>         `string`
>       </td>
>
>       <td>No</td>
>
>       <td>
>         `"en"`
>       </td>
>
>       <td>Fallback language code when translations are missing</td>
>     </tr>
>   </tbody>
> </table>
>
> ***
>
> **themeSettings**
>
> <table>
>   <thead>
>     <tr>
>       <th>Property</th>
>       <th>Type</th>
>       <th>Default</th>
>       <th>Description</th>
>     </tr>
>   </thead>
>
>   <tbody>
>     <tr>
>       <td>
>         `mode`
>       </td>
>
>       <td>
>         `"light" | "dark"`
>       </td>
>
>       <td>
>         `"light"`
>       </td>
>
>       <td>Theme color mode</td>
>     </tr>
>
>     <tr>
>       <td>
>         `theme`
>       </td>
>
>       <td>
>         `"default" | "minimal" | "rounded"`
>       </td>
>
>       <td>
>         `"default"`
>       </td>
>
>       <td>Theme variant with different styling approaches</td>
>     </tr>
>
>     <tr>
>       <td>
>         `variables`
>       </td>
>
>       <td>
>         `StylingVariables`
>       </td>
>
>       <td />
>
>       <td>CSS custom properties for common, light, and dark themes</td>
>     </tr>
>   </tbody>
> </table>
>
> > [accordion] Available CSS Variables
> >
> > **Common (applies to all themes):**
> >
> > **Typography:**
> >
> > * `--font-size-page-header`
> > * `--font-size-page-description`
> > * `--font-size-heading`
> > * `--font-size-title`
> > * `--font-size-subtitle`
> > * `--font-size-body`
> > * `--font-size-paragraph`
> > * `--font-size-label`
> >
> > **Border Radius:**
> >
> > * `--radius-xs` through `--radius-9xl`
> >
> > **Light & Dark (theme-specific colors and shadows):**
> >
> > **Colors:**
> >
> > * `--background`, `--foreground`
> > * `--card`, `--card-foreground`
> > * `--primary`, `--primary-foreground`
> > * `--secondary`, `--secondary-foreground`
> > * `--accent`, `--accent-foreground`
> > * `--muted`, `--muted-foreground`
> > * `--destructive`, `--destructive-foreground`
> > * `--popover`, `--popover-foreground`
> > * `--input`, `--border`, `--ring`
> > * `--color-page`
> > * `--color-info`, `--color-info-foreground`
> > * `--color-success`, `--color-success-foreground`
> > * `--color-warning`, `--color-warning-foreground`
> > * `--color-destructive-border`
> > * `--color-popover-border`
> > * `--color-input-foreground`
> > * `--color-input-muted`
> >
> > **Shadows:**
> >
> > * `--shadow-bevel-*` (xs, sm, md, lg, xl, 2xl)
> > * `--shadow-button-*` (resting, hover, focus)
> > * `--shadow-button-destructive-*`
> > * `--shadow-button-outlined-*`
> > * `--shadow-input-*` (resting, hover, focus)
> > * `--shadow-input-destructive-*`
> > * `--shadow-checkbox-*` (resting, hover)
> > * `--shadow-switch-*` (resting, hover, focus, thumb, thumb-dark)
>
> For detailed styling examples and customization patterns, read the [Customize
> Style and Themes with Universal
> Components](/docs/docs/get-started/universal-components/web/universal-components-style).
>
> ***
>
> **toastSettings**
>
> Toast settings support two provider types: **Sonner** (default) or **custom**. Each provider has its own configuration structure for better type safety.
>
> > [tab] Sonner Provider (Default)
> >
> > | Property | Type | Default | Description |
> > | - | - | - | - |
> > | `provider` | `"sonner"` | `"sonner"` | Uses the built-in Sonner toast library |
> > | `settings.position` | `ToastPosition` | `"top-right"` | Position where toasts appear: "top-left", "top-right", "bottom-left", "bottom-right", "top-center", "bottom-center" |
> > | `settings.duration` | `number` | `4000` | Duration in milliseconds before toast auto-dismisses (Sonner default) |
> > | `settings.maxToasts` | `number` | - | Maximum number of toasts visible at once |
> > | `settings.dismissible` | `boolean` | `true` | Whether toasts can be manually dismissed by user interaction (Sonner default) |
> > | `settings.closeButton` | `boolean` | `true` | Whether to show an explicit close button on toasts |
> >
> > ```tsx Sonner Provider Example theme={null}
> > const toastSettings = {
> >   provider: 'sonner', // Optional, this is the default
> >   settings: {
> >     position: 'top-center',
> >     duration: 6000,
> >     maxToasts: 5,
> >     dismissible: true,
> >     closeButton: true
> >   }
> > };
> > ```
>
> > [tab] Custom Provider
> >
> > | Property | Type | Required | Description |
> > | - | - | - | - |
> > | `provider` | `"custom"` | Yes | Uses your custom toast implementation |
> > | `methods.success` | `(message: string) => void` | No | Custom success toast handler |
> > | `methods.error` | `(message: string) => void` | No | Custom error toast handler |
> > | `methods.warning` | `(message: string) => void` | No | Custom warning toast handler |
> > | `methods.info` | `(message: string) => void` | No | Custom info toast handler |
> > | `methods.dismiss` | `(toastId?: string) => void` | No | Custom dismiss handler |
> >
> > ```tsx Custom Provider Example theme={null}
> > const toastSettings = {
> >   provider: 'custom',
> >   methods: {
> >     success: (message: string) => {
> >       // Your custom success toast implementation
> >       myToastLibrary.success(message);
> >     },
> >     error: (message: string) => {
> >       // Your custom error toast implementation
> >       myToastLibrary.error(message);
> >     },
> >     warning: (message: string) => {
> >       // Your custom warning toast implementation
> >       myToastLibrary.warning(message);
> >     },
> >     info: (message: string) => {
> >       // Your custom info toast implementation
> >       myToastLibrary.info(message);
> >     },
> >     dismiss: (toastId?: string) => {
> >       // Your custom dismiss implementation
> >       myToastLibrary.dismiss(toastId);
> >     }
> >   }
> > };
> > ```
> >
> > All custom methods are optional. Only implement the ones you need. Methods
> > receive the message text only—your implementation handles styling,
> > positioning, and timing.
>
> ***
>
> ## State and performance
>
> Fine-tune TanStack Query caching for every Auth0 component. Defaults keep data fresh for two minutes, garbage-collect after five minutes, and skip window-focus refetches.
>
> <table>
>   <thead>
>     <tr>
>       <th>Property</th>
>       <th>Type</th>
>       <th>Default</th>
>       <th>Description</th>
>     </tr>
>   </thead>
>
>   <tbody>
>     <tr>
>       <td>
>         `enabled`
>       </td>
>
>       <td>
>         `boolean`
>       </td>
>
>       <td>
>         `true`
>       </td>
>
>       <td>
>         Toggle caching altogether. When set to `false`, stale data is
>         disabled and cached entries are cleared quickly.
>       </td>
>     </tr>
>
>     <tr>
>       <td>
>         `staleTime`
>       </td>
>
>       <td>
>         `number`
>       </td>
>
>       <td>
>         `120000`
>       </td>
>
>       <td>
>         Milliseconds before data becomes stale. Default is two minutes. Increase
>         for dashboards, decrease for critical workflows.
>       </td>
>     </tr>
>
>     <tr>
>       <td>
>         `gcTime`
>       </td>
>
>       <td>
>         `number`
>       </td>
>
>       <td>
>         `300000`
>       </td>
>
>       <td>
>         Milliseconds before inactive queries are garbage-collected. Default is five minutes.
>       </td>
>     </tr>
>
>     <tr>
>       <td>
>         `refetchOnWindowFocus`
>       </td>
>
>       <td>
>         `boolean | "always"`
>       </td>
>
>       <td>
>         `false`
>       </td>
>
>       <td>
>         Controls whether queries refetch when the browser regains focus. Use&#x20;
>         `"always"` for strict freshness.
>       </td>
>     </tr>
>   </tbody>
> </table>
>
> **Disable caching:** Pass `{ enabled: false }`. This automatically sets `staleTime` to 0 and shortens the garbage-collection window to five seconds so every render fetches fresh data.
>
> **Pro tip:** Keep caching enabled but shorten `staleTime` when integrating with admin panels that require near-real-time updates.
>
> > [tab] Tune TTL
> >
> > ```tsx theme={null}
> > <Auth0ComponentProvider
> >   domain="your-tenant.auth0.com"
> >   cacheConfig={{
> >     staleTime: 10 * 60 * 1000,
> >     gcTime: 15 * 60 * 1000,
> >     refetchOnWindowFocus: true,
> >   }}
> > >
> >   <App />
> > </Auth0ComponentProvider>
> > ```
>
> > [tab] Disable Cache
> >
> > ```tsx theme={null}
> > <Auth0ComponentProvider
> >   domain="your-tenant.auth0.com"
> >   cacheConfig={{ enabled: false }}
> > >
> >   <App />
> > </Auth0ComponentProvider>
> > ```

> [tab] Next.js
>
> ```tsx layout.tsx theme={null}
> import { Auth0ComponentProvider } from "@auth0/universal-components-react/rwa";
>
> export default function RootLayout({ children }) {
>   return (
>     <html lang="en">
>       <body>
>         <Auth0ComponentProvider
>           mode="proxy"
>           domain="your-tenant.auth0.com"
>           proxyConfig={{ baseUrl: "/api/auth" }}
>         >
>           {children}
>         </Auth0ComponentProvider>
>       </body>
>     </html>
>   );
> }
> ```
>
> ***
>
> ## Properties
>
> <table>
>   <thead>
>     <tr>
>       <th>Property</th>
>       <th>Type</th>
>       <th>Required</th>
>       <th>Description</th>
>     </tr>
>   </thead>
>
>   <tbody>
>     <tr>
>       <td>`domain`</td>
>       <td>`string`</td>
>       <td>Yes</td>
>       <td>Auth0 tenant domain (for example, "your-tenant.auth0.com"). Required for proxy mode.</td>
>     </tr>
>
>     <tr>
>       <td>`mode`</td>
>       <td>`'proxy'`</td>
>       <td>Yes</td>
>       <td>For Next.js, always use `'proxy'` mode for server-side authentication.</td>
>     </tr>
>
>     <tr>
>       <td>`proxyConfig`</td>
>       <td>`{ baseUrl: string }`</td>
>       <td>Yes</td>
>       <td>Proxy configuration with base URL to your authentication proxy server.</td>
>     </tr>
>
>     <tr>
>       <td>`previewMode`</td>
>       <td>`boolean`</td>
>       <td>No</td>
>       <td>When `true`, skips API client initialization. Used for documentation previews and demos.</td>
>     </tr>
>
>     <tr>
>       <td>`i18n`</td>
>       <td>`I18nOptions`</td>
>       <td>No</td>
>       <td>Internationalization settings including currentLanguage and fallbackLanguage.</td>
>     </tr>
>
>     <tr>
>       <td>`themeSettings`</td>
>       <td>`ThemeSettings`</td>
>       <td>No</td>
>       <td>Theme configuration including mode (light/dark), theme variant (default/minimal/rounded), and CSS variables.</td>
>     </tr>
>
>     <tr>
>       <td>`toastSettings`</td>
>       <td>`ToastSettings`</td>
>       <td>No</td>
>       <td>Toast notification configuration including provider selection (sonner/custom), positioning, duration, and custom toast methods.</td>
>     </tr>
>
>     <tr>
>       <td>`cacheConfig`</td>
>       <td>`QueryCacheConfig`</td>
>       <td>No</td>
>       <td>Controls TanStack Query caching (two min stale / five min GC by default). Set `enabled: false` to force fresh data.</td>
>     </tr>
>
>     <tr>
>       <td>`loader`</td>
>       <td>`React.ReactNode`</td>
>       <td>No</td>
>       <td>Custom loading component to display during authentication initialization.</td>
>     </tr>
>   </tbody>
> </table>
>
> ***
>
> ## Configure proxy mode
>
> For Next.js applications, use proxy mode with server-side authentication:
>
> ```tsx layout.tsx theme={null}
> import { Auth0ComponentProvider } from "@auth0/universal-components-react/rwa";
>
> export default function RootLayout({ children }) {
>   return (
>     <html lang="en">
>       <body>
>         <Auth0ComponentProvider
>           mode="proxy"
>           domain="your-tenant.auth0.com"
>           proxyConfig={{ baseUrl: "/api/auth" }}
>         >
>           {children}
>         </Auth0ComponentProvider>
>       </body>
>     </html>
>   );
> }
> ```
>
> ***
>
> ### Proxy mode properties
>
> Configuration for proxy mode authentication. Required when using Next.js.
>
> <table>
>   <thead>
>     <tr>
>       <th>Property</th>
>       <th>Type</th>
>       <th>Required</th>
>       <th>Description</th>
>     </tr>
>   </thead>
>
>   <tbody>
>     <tr>
>       <td>
>         `baseUrl`
>       </td>
>
>       <td>
>         `string`
>       </td>
>
>       <td>Yes</td>
>
>       <td>
>         URL to your authentication proxy server (for example, "/api/auth"). API calls
>         append to this base path.
>       </td>
>     </tr>
>   </tbody>
> </table>
>
> ***
>
> ## User experience
>
> ***
>
> **i18n**
>
> <table>
>   <thead>
>     <tr>
>       <th>Property</th>
>       <th>Type</th>
>       <th>Required</th>
>       <th>Default</th>
>       <th>Description</th>
>     </tr>
>   </thead>
>
>   <tbody>
>     <tr>
>       <td>
>         `currentLanguage`
>       </td>
>
>       <td>
>         `string`
>       </td>
>
>       <td>Yes</td>
>       <td>-</td>
>       <td>Current language code (for example, "en", "es", "fr")</td>
>     </tr>
>
>     <tr>
>       <td>
>         `fallbackLanguage`
>       </td>
>
>       <td>
>         `string`
>       </td>
>
>       <td>No</td>
>
>       <td>
>         `"en"`
>       </td>
>
>       <td>Fallback language code when translations are missing</td>
>     </tr>
>   </tbody>
> </table>
>
> ***
>
> **themeSettings**
>
> <table>
>   <thead>
>     <tr>
>       <th>Property</th>
>       <th>Type</th>
>       <th>Default</th>
>       <th>Description</th>
>     </tr>
>   </thead>
>
>   <tbody>
>     <tr>
>       <td>
>         `mode`
>       </td>
>
>       <td>
>         `"light" | "dark"`
>       </td>
>
>       <td>
>         `"light"`
>       </td>
>
>       <td>Theme color mode</td>
>     </tr>
>
>     <tr>
>       <td>
>         `theme`
>       </td>
>
>       <td>
>         `"default" | "minimal" | "rounded"`
>       </td>
>
>       <td>
>         `"default"`
>       </td>
>
>       <td>Theme variant with different styling approaches</td>
>     </tr>
>
>     <tr>
>       <td>
>         `variables`
>       </td>
>
>       <td>
>         `StylingVariables`
>       </td>
>
>       <td />
>
>       <td>CSS custom properties for common, light, and dark themes</td>
>     </tr>
>   </tbody>
> </table>
>
> > [accordion] Available CSS Variables
> >
> > **Common (applies to all themes):**
> >
> > **Typography:**
> >
> > * `--font-size-page-header`
> > * `--font-size-page-description`
> > * `--font-size-heading`
> > * `--font-size-title`
> > * `--font-size-subtitle`
> > * `--font-size-body`
> > * `--font-size-paragraph`
> > * `--font-size-label`
> >
> > **Border Radius:**
> >
> > * `--radius-xs` through `--radius-9xl`
> >
> > **Light & Dark (theme-specific colors and shadows):**
> >
> > **Colors:**
> >
> > * `--background`, `--foreground`
> > * `--card`, `--card-foreground`
> > * `--primary`, `--primary-foreground`
> > * `--secondary`, `--secondary-foreground`
> > * `--accent`, `--accent-foreground`
> > * `--muted`, `--muted-foreground`
> > * `--destructive`, `--destructive-foreground`
> > * `--popover`, `--popover-foreground`
> > * `--input`, `--border`, `--ring`
> > * `--color-page`
> > * `--color-info`, `--color-info-foreground`
> > * `--color-success`, `--color-success-foreground`
> > * `--color-warning`, `--color-warning-foreground`
> > * `--color-destructive-border`
> > * `--color-popover-border`
> > * `--color-input-foreground`
> > * `--color-input-muted`
> >
> > **Shadows:**
> >
> > * `--shadow-bevel-*` (xs, sm, md, lg, xl, 2xl)
> > * `--shadow-button-*` (resting, hover, focus)
> > * `--shadow-button-destructive-*`
> > * `--shadow-button-outlined-*`
> > * `--shadow-input-*` (resting, hover, focus)
> > * `--shadow-input-destructive-*`
> > * `--shadow-checkbox-*` (resting, hover)
> > * `--shadow-switch-*` (resting, hover, focus, thumb, thumb-dark)
>
> For detailed styling examples and customization patterns, read the [Customize
> Style and Themes with Universal
> Components](/docs/docs/get-started/universal-components/web/universal-components-style).
>
> ***
>
> **toastSettings**
>
> Toast settings support two provider types: **Sonner** (default) or **custom**. Each provider has its own configuration structure for better type safety.
>
> > [accordion] Sonner Provider (Default)
> >
> > | Property | Type | Default | Description |
> > | - | - | - | - |
> > | `provider` | `"sonner"` | `"sonner"` | Uses the built-in Sonner toast library |
> > | `settings.position` | `ToastPosition` | `"top-right"` | Position where toasts appear: "top-left", "top-right", "bottom-left", "bottom-right", "top-center", "bottom-center" |
> > | `settings.duration` | `number` | `4000` | Duration in milliseconds before toast auto-dismisses (Sonner default) |
> > | `settings.maxToasts` | `number` | - | Maximum number of toasts visible at once |
> > | `settings.dismissible` | `boolean` | `true` | Whether toasts can be manually dismissed by user interaction (Sonner default) |
> > | `settings.closeButton` | `boolean` | `true` | Whether to show an explicit close button on toasts |
> >
> > ```tsx Sonner Provider Example theme={null}
> > const toastSettings = {
> >   provider: 'sonner', // Optional, this is the default
> >   settings: {
> >     position: 'top-center',
> >     duration: 6000,
> >     maxToasts: 5,
> >     dismissible: true,
> >     closeButton: true
> >   }
> > };
> > ```
>
> > [accordion] Custom Provider
> >
> > | Property | Type | Required | Description |
> > | - | - | - | - |
> > | `provider` | `"custom"` | Yes | Uses your custom toast implementation |
> > | `methods.success` | `(message: string) => void` | No | Custom success toast handler |
> > | `methods.error` | `(message: string) => void` | No | Custom error toast handler |
> > | `methods.warning` | `(message: string) => void` | No | Custom warning toast handler |
> > | `methods.info` | `(message: string) => void` | No | Custom info toast handler |
> > | `methods.dismiss` | `(toastId?: string) => void` | No | Custom dismiss handler |
> >
> > ```tsx Custom Provider Example theme={null}
> > const toastSettings = {
> >   provider: 'custom',
> >   methods: {
> >     success: (message: string) => {
> >       // Your custom success toast implementation
> >       myToastLibrary.success(message);
> >     },
> >     error: (message: string) => {
> >       // Your custom error toast implementation
> >       myToastLibrary.error(message);
> >     },
> >     warning: (message: string) => {
> >       // Your custom warning toast implementation
> >       myToastLibrary.warning(message);
> >     },
> >     info: (message: string) => {
> >       // Your custom info toast implementation
> >       myToastLibrary.info(message);
> >     },
> >     dismiss: (toastId?: string) => {
> >       // Your custom dismiss implementation
> >       myToastLibrary.dismiss(toastId);
> >     }
> >   }
> > };
> > ```
> >
> > All custom methods are optional. Only implement the ones you need. Methods receive the message text only—your implementation handles styling, positioning, and timing.
>
> ***
>
> ## State and performance
>
> Fine-tune TanStack Query caching for every Auth0 component. Defaults keep data fresh for two minutes, garbage-collect after five minutes, and skip window-focus refetches.
>
> <table>
>   <thead>
>     <tr>
>       <th>Property</th>
>       <th>Type</th>
>       <th>Default</th>
>       <th>Description</th>
>     </tr>
>   </thead>
>
>   <tbody>
>     <tr>
>       <td>
>         `enabled`
>       </td>
>
>       <td>
>         `boolean`
>       </td>
>
>       <td>
>         `true`
>       </td>
>
>       <td>
>         Toggle caching altogether. When set to `false`, stale data is
>         disabled and cached entries are cleared quickly.
>       </td>
>     </tr>
>
>     <tr>
>       <td>
>         `staleTime`
>       </td>
>
>       <td>
>         `number`
>       </td>
>
>       <td>
>         `120000`
>       </td>
>
>       <td>
>         Milliseconds before data becomes stale (two minutes by default). Increase
>         for dashboards, decrease for critical workflows.
>       </td>
>     </tr>
>
>     <tr>
>       <td>
>         `gcTime`
>       </td>
>
>       <td>
>         `number`
>       </td>
>
>       <td>
>         `300000`
>       </td>
>
>       <td>
>         Milliseconds before inactive queries are garbage-collected (five minutes by
>         default).
>       </td>
>     </tr>
>
>     <tr>
>       <td>
>         `refetchOnWindowFocus`
>       </td>
>
>       <td>
>         `boolean | "always"`
>       </td>
>
>       <td>
>         `false`
>       </td>
>
>       <td>
>         Controls whether queries refetch when the browser regains focus. Use&#x20;
>         `"always"` for strict freshness.
>       </td>
>     </tr>
>   </tbody>
> </table>
>
> **Disable caching:** Pass `{ enabled: false }`. This automatically sets `staleTime` to 0 and shortens the garbage-collection window to 5 seconds so every render fetches fresh data.
>
> **Pro tip:** Keep caching enabled but shorten `staleTime` when integrating with admin panels that require near-real-time updates.
>
> > [accordion] Tune TTL
> >
> > ```tsx layout.tsx theme={null}
> > <Auth0ComponentProvider
> >   mode="proxy"
> >   domain="your-tenant.auth0.com"
> >   proxyConfig={{ baseUrl: "/api/auth" }}
> >   cacheConfig={{
> >     staleTime: 10 * 60 * 1000,
> >     gcTime: 15 * 60 * 1000,
> >     refetchOnWindowFocus: true,
> >   }}
> > >
> >   <App />
> > </Auth0ComponentProvider>
> > ```
>
> > [accordion] Disable Cache
> >
> > ```tsx layout.tsx theme={null}
> > <Auth0ComponentProvider
> >   mode="proxy"
> >   domain="your-tenant.auth0.com"
> >   proxyConfig={{ baseUrl: "/api/auth" }}
> >   cacheConfig={{ enabled: false }}
> > >
> >   <App />
> > </Auth0ComponentProvider>
> > ```

> [tab] shadcn
>
> **Security recommendation:** For production applications that manage Organization configuration, Auth0 recommends the [Next.js setup](/docs/docs/get-started/universal-components/auth0-component-provider#next-js) (Regular Web App). Next.js proxy mode stores tokens server-side, which reduces the attack surface compared to browser-stored tokens in a Single Page Application. If you use React SPA mode, review the [Token Storage](/docs/docs/secure/security-guidance/data-security/token-storage) guidance to understand the tradeoffs.
>
> ```tsx App.tsx theme={null}
> import { Auth0Provider } from "@auth0/auth0-react";
> import { Auth0ComponentProvider } from "@auth0/universal-components-react/spa";
>
> function App() {
>   return (
>     <Auth0Provider
>       domain="your-tenant.auth0.com"
>       clientId="YOUR_CLIENT_ID"
>       authorizationParams={{ redirect_uri: window.location.origin }}
>       interactiveErrorHandler='popup' // Required to handle step-up auth challenges via Universal Login popup
>     >
>       <Auth0ComponentProvider>
>         {/* Your app with Auth0 Universal Components */}
>       </Auth0ComponentProvider>
>     </Auth0Provider>
>   );
> }
> ```
>
> ***
>
> ## Properties
>
> <table>
>   <thead>
>     <tr>
>       <th>Property</th>
>       <th>Type</th>
>       <th>Required</th>
>       <th>Description</th>
>     </tr>
>   </thead>
>
>   <tbody>
>     <tr>
>       <td>`domain`</td>
>       <td>`string`</td>
>       <td>Yes</td>
>       <td>Auth0 tenant domain (for example, "your-tenant.auth0.com").</td>
>     </tr>
>
>     <tr>
>       <td>`authContext`</td>
>       <td>`ContextInterface`</td>
>       <td>No</td>
>       <td>Custom authentication context for SPAs not using `@auth0/auth0-react`. Provides auth functions, such as `getAccessTokenSilently`.</td>
>     </tr>
>
>     <tr>
>       <td>`previewMode`</td>
>       <td>`boolean`</td>
>       <td>No</td>
>       <td>When `true`, skips API client initialization. Used for documentation previews and demos.</td>
>     </tr>
>
>     <tr>
>       <td>`i18n`</td>
>       <td>`I18nOptions`</td>
>       <td>No</td>
>       <td>Internationalization settings including currentLanguage and fallbackLanguage.</td>
>     </tr>
>
>     <tr>
>       <td>`themeSettings`</td>
>       <td>`ThemeSettings`</td>
>       <td>No</td>
>       <td>Theme configuration including mode (light/dark), theme variant (default/minimal/rounded), and CSS variables.</td>
>     </tr>
>
>     <tr>
>       <td>`toastSettings`</td>
>       <td>`ToastSettings`</td>
>       <td>No</td>
>       <td>Toast notification configuration including provider selection (sonner/custom), positioning, duration, and custom toast methods.</td>
>     </tr>
>
>     <tr>
>       <td>`cacheConfig`</td>
>       <td>`QueryCacheConfig`</td>
>       <td>No</td>
>       <td>Controls TanStack Query caching (two min stale / five min GC by default). Set `enabled: false` to force fresh data.</td>
>     </tr>
>
>     <tr>
>       <td>`loader`</td>
>       <td>`React.ReactNode`</td>
>       <td>No</td>
>       <td>Custom loading component to display during authentication initialization.</td>
>     </tr>
>   </tbody>
> </table>
>
> ***
>
> ## User experience
>
> ***
>
> **i18n**
>
> <table>
>   <thead>
>     <tr>
>       <th>Property</th>
>       <th>Type</th>
>       <th>Required</th>
>       <th>Default</th>
>       <th>Description</th>
>     </tr>
>   </thead>
>
>   <tbody>
>     <tr>
>       <td>
>         `currentLanguage`
>       </td>
>
>       <td>
>         `string`
>       </td>
>
>       <td>Yes</td>
>       <td>-</td>
>       <td>Current language code (for example, "en", "es", "fr")</td>
>     </tr>
>
>     <tr>
>       <td>
>         `fallbackLanguage`
>       </td>
>
>       <td>
>         `string`
>       </td>
>
>       <td>No</td>
>
>       <td>
>         `"en"`
>       </td>
>
>       <td>Fallback language code when translations are missing</td>
>     </tr>
>   </tbody>
> </table>
>
> ***
>
> **themeSettings**
>
> <table>
>   <thead>
>     <tr>
>       <th>Property</th>
>       <th>Type</th>
>       <th>Default</th>
>       <th>Description</th>
>     </tr>
>   </thead>
>
>   <tbody>
>     <tr>
>       <td>
>         `mode`
>       </td>
>
>       <td>
>         `"light" | "dark"`
>       </td>
>
>       <td>
>         `"light"`
>       </td>
>
>       <td>Theme color mode</td>
>     </tr>
>
>     <tr>
>       <td>
>         `theme`
>       </td>
>
>       <td>
>         `"default" | "minimal" | "rounded"`
>       </td>
>
>       <td>
>         `"default"`
>       </td>
>
>       <td>Theme variant with different styling approaches</td>
>     </tr>
>
>     <tr>
>       <td>
>         `variables`
>       </td>
>
>       <td>
>         `StylingVariables`
>       </td>
>
>       <td />
>
>       <td>CSS custom properties for common, light, and dark themes</td>
>     </tr>
>   </tbody>
> </table>
>
> > [accordion] Available CSS Variables
> >
> > **Common (applies to all themes):**
> >
> > **Typography:**
> >
> > * `--font-size-page-header`
> > * `--font-size-page-description`
> > * `--font-size-heading`
> > * `--font-size-title`
> > * `--font-size-subtitle`
> > * `--font-size-body`
> > * `--font-size-paragraph`
> > * `--font-size-label`
> >
> > **Border Radius:**
> >
> > * `--radius-xs` through `--radius-9xl`
> >
> > **Light & Dark (theme-specific colors and shadows):**
> >
> > **Colors:**
> >
> > * `--background`, `--foreground`
> > * `--card`, `--card-foreground`
> > * `--primary`, `--primary-foreground`
> > * `--secondary`, `--secondary-foreground`
> > * `--accent`, `--accent-foreground`
> > * `--muted`, `--muted-foreground`
> > * `--destructive`, `--destructive-foreground`
> > * `--popover`, `--popover-foreground`
> > * `--input`, `--border`, `--ring`
> > * `--color-page`
> > * `--color-info`, `--color-info-foreground`
> > * `--color-success`, `--color-success-foreground`
> > * `--color-warning`, `--color-warning-foreground`
> > * `--color-destructive-border`
> > * `--color-popover-border`
> > * `--color-input-foreground`
> > * `--color-input-muted`
> >
> > **Shadows:**
> >
> > * `--shadow-bevel-*` (xs, sm, md, lg, xl, 2xl)
> > * `--shadow-button-*` (resting, hover, focus)
> > * `--shadow-button-destructive-*`
> > * `--shadow-button-outlined-*`
> > * `--shadow-input-*` (resting, hover, focus)
> > * `--shadow-input-destructive-*`
> > * `--shadow-checkbox-*` (resting, hover)
> > * `--shadow-switch-*` (resting, hover, focus, thumb, thumb-dark)
>
> For detailed styling examples and customization patterns, read the [Customize
> Style and Themes with Universal
> Components](/docs/docs/get-started/universal-components/web/universal-components-style).
>
> ***
>
> **toastSettings**
>
> Toast settings support two provider types: **Sonner** (default) or **custom**. Each provider has its own configuration structure for better type safety.
>
> > [tab] Sonner Provider (Default)
> >
> > | Property | Type | Default | Description |
> > | - | - | - | - |
> > | `provider` | `"sonner"` | `"sonner"` | Uses the built-in Sonner toast library |
> > | `settings.position` | `ToastPosition` | `"top-right"` | Position where toasts appear: "top-left", "top-right", "bottom-left", "bottom-right", "top-center", "bottom-center" |
> > | `settings.duration` | `number` | `4000` | Duration in milliseconds before toast auto-dismisses (Sonner default) |
> > | `settings.maxToasts` | `number` | - | Maximum number of toasts visible at once |
> > | `settings.dismissible` | `boolean` | `true` | Whether toasts can be manually dismissed by user interaction (Sonner default) |
> > | `settings.closeButton` | `boolean` | `true` | Whether to show an explicit close button on toasts |
> >
> > ```tsx Sonner Provider Example theme={null}
> > const toastSettings = {
> >   provider: 'sonner', // Optional, this is the default
> >   settings: {
> >     position: 'top-center',
> >     duration: 6000,
> >     maxToasts: 5,
> >     dismissible: true,
> >     closeButton: true
> >   }
> > };
> > ```
>
> > [tab] Custom Provider
> >
> > | Property | Type | Required | Description |
> > | - | - | - | - |
> > | `provider` | `"custom"` | Yes | Uses your custom toast implementation |
> > | `methods.success` | `(message: string) => void` | No | Custom success toast handler |
> > | `methods.error` | `(message: string) => void` | No | Custom error toast handler |
> > | `methods.warning` | `(message: string) => void` | No | Custom warning toast handler |
> > | `methods.info` | `(message: string) => void` | No | Custom info toast handler |
> > | `methods.dismiss` | `(toastId?: string) => void` | No | Custom dismiss handler |
> >
> > ```tsx Custom Provider Example theme={null}
> > const toastSettings = {
> >   provider: 'custom',
> >   methods: {
> >     success: (message: string) => {
> >       // Your custom success toast implementation
> >       myToastLibrary.success(message);
> >     },
> >     error: (message: string) => {
> >       // Your custom error toast implementation
> >       myToastLibrary.error(message);
> >     },
> >     warning: (message: string) => {
> >       // Your custom warning toast implementation
> >       myToastLibrary.warning(message);
> >     },
> >     info: (message: string) => {
> >       // Your custom info toast implementation
> >       myToastLibrary.info(message);
> >     },
> >     dismiss: (toastId?: string) => {
> >       // Your custom dismiss implementation
> >       myToastLibrary.dismiss(toastId);
> >     }
> >   }
> > };
> > ```
> >
> > All custom methods are optional. Only implement the ones you need. Methods
> > receive the message text only—your implementation handles styling,
> > positioning, and timing.
>
> ***
>
> ## State and performance
>
> Fine-tune TanStack Query caching for every Auth0 component. Defaults keep data fresh for two minutes, garbage-collect after five minutes, and skip window-focus refetches.
>
> <table>
>   <thead>
>     <tr>
>       <th>Property</th>
>       <th>Type</th>
>       <th>Default</th>
>       <th>Description</th>
>     </tr>
>   </thead>
>
>   <tbody>
>     <tr>
>       <td>
>         `enabled`
>       </td>
>
>       <td>
>         `boolean`
>       </td>
>
>       <td>
>         `true`
>       </td>
>
>       <td>
>         Toggle caching altogether. When set to `false`, stale data is
>         disabled and cached entries are cleared quickly.
>       </td>
>     </tr>
>
>     <tr>
>       <td>
>         `staleTime`
>       </td>
>
>       <td>
>         `number`
>       </td>
>
>       <td>
>         `120000`
>       </td>
>
>       <td>
>         Milliseconds before data becomes stale (two minutes by default). Increase
>         for dashboards, decrease for critical workflows.
>       </td>
>     </tr>
>
>     <tr>
>       <td>
>         `gcTime`
>       </td>
>
>       <td>
>         `number`
>       </td>
>
>       <td>
>         `300000`
>       </td>
>
>       <td>
>         Milliseconds before inactive queries are garbage-collected (5 minutes by
>         default).
>       </td>
>     </tr>
>
>     <tr>
>       <td>
>         `refetchOnWindowFocus`
>       </td>
>
>       <td>
>         `boolean | "always"`
>       </td>
>
>       <td>
>         `false`
>       </td>
>
>       <td>
>         Controls whether queries refetch when the browser regains focus. Use&#x20;
>         `"always"` for strict freshness.
>       </td>
>     </tr>
>   </tbody>
> </table>
>
> **Disable caching:** Pass `{ enabled: false }`. This automatically sets `staleTime` to 0 and shortens the garbage-collection window to 5 seconds so every render fetches fresh data.
>
> **Pro tip:** Keep caching enabled but shorten `staleTime` when integrating with admin panels that require near-real-time updates.
>
> > [tab] Tune TTL
> >
> > ```tsx App.tsx theme={null}
> > <Auth0ComponentProvider
> >   domain="your-tenant.auth0.com"
> >   cacheConfig={{
> >     staleTime: 10 * 60 * 1000,
> >     gcTime: 15 * 60 * 1000,
> >     refetchOnWindowFocus: true,
> >   }}
> > >
> >   <App />
> > </Auth0ComponentProvider>
> > ```
>
> > [tab] Disable Cache
> >
> > ```tsx App.tsx theme={null}
> > <Auth0ComponentProvider
> >   domain="your-tenant.auth0.com"
> >   cacheConfig={{ enabled: false }}
> > >
> >   <App />
> > </Auth0ComponentProvider>
> > ```
