|
1 | | -# Auth0 Universal Components for Web |
| 1 | + |
2 | 2 |
|
3 | | -A comprehensive library of reusable UI components and utilities for Auth0 integrations, built with modern web technologies and designed for scalability. |
| 3 | +Drop-in React components for Auth0 organization management, SSO configuration, and MFA enrollment. |
4 | 4 |
|
5 | | -## 📖 Documentation |
| 5 | +[](https://www.npmjs.com/package/@auth0/universal-components-react) |
| 6 | +[](https://github.com/auth0/auth0-ui-components/blob/main/LICENSE) |
| 7 | +[](https://www.npmjs.com/package/@auth0/universal-components-react) |
6 | 8 |
|
7 | | -For detailed information on how to use these components and get started with Auth0, please refer to the following resources: |
| 9 | +> [!IMPORTANT] |
| 10 | +> **Early Access**: This feature is currently in Early Access. To learn more, see [Product Release Stages](https://auth0.com/docs/troubleshoot/product-lifecycle/product-release-stages). |
8 | 11 |
|
9 | | -- **[Auth0 Quickstarts](https://auth0.com/docs/quickstarts)**: Official guides for creating and configuring your application on the Auth0 platform. |
10 | | -- **[Auth0 APIs](https://auth0.com/docs/api)**: Comprehensive documentation for Auth0's APIs. |
11 | | -- **[Component Documentation](https://auth0-ui-components.vercel.app/)**: Live Storybook showcasing all available components, their props, and usage examples. |
12 | | -- **[Examples Folder](https://github.com/auth0/auth0-ui-components/tree/main/examples)**: Practical, hands-on sample applications demonstrating how to integrate and use these components in a real project. |
13 | | -- **[Component Reference](#-component-reference)**: Explore public components available in @auth0/universal-components-react. |
| 12 | +📚 [Documentation](#documentation) - 🚀 [Quick Start](#quick-start) - 💬 [Feedback](#feedback) |
14 | 13 |
|
15 | | -## Packages Overview |
| 14 | +<p align="center"> |
| 15 | + <img src="https://cdn.auth0.com/website/sdks/banners/SSOProviderCreateComponent.gif" alt="SSO Provider Configuration" width="700"> |
| 16 | + <br> |
| 17 | + <sub>SSO Provider Create Component</sub> |
| 18 | +</p> |
16 | 19 |
|
17 | | -This project uses a **monorepo architecture** designed for multi-framework support. It is organized into two main types of packages: |
18 | | - |
19 | | -- A framework-agnostic `@auth0/universal-components-core` package that contains all the core logic, services, and utilities. |
20 | | -- Framework-specific packages (like `@auth0/universal-components-react`) that provide UI components and hooks for a particular technology. This structure allows for the future addition of packages for other frameworks like Vue or Angular. |
21 | | - |
22 | | -### `packages/core/` |
23 | | - |
24 | | -**@auth0/universal-components-core** - The foundational package containing core utilities and services. |
25 | | - |
26 | | -**What it provides:** |
27 | | - |
28 | | -- 📦 **Internal Services**: Handles all API logic for "My Account" and "My Organization" components, using the "My Account" and "My Organization" SDKs. |
29 | | -- 🌐 **Internationalization (i18n)**: Contains all translation files for multi-language support and utils. |
30 | | -- 🛡️ **Schema Validation**: Defines and maintains types for schema validation. |
31 | | -- 🛠️ **Shared Utilities**: Provides shared functions, TypeScript types, and theme management utilities. |
32 | | - |
33 | | -### `packages/react/` |
34 | | - |
35 | | -**@auth0/universal-components-react** - React-specific UI components and hooks for Auth0 integrations. |
36 | | - |
37 | | -**What it provides:** |
38 | | - |
39 | | -- ⚛️ **React Components**: Pre-built UI components for Auth0 features (MFA management, user profiles, ,organization management etc.) |
40 | | -- 🎣 **Custom Hooks**: React hooks for component state management and API interactions |
41 | | -- 🎨 **UI Elements**: Beautiful, accessible components built with Radix UI and Tailwind CSS, following shadcn design patterns. |
42 | | -- 🔄 **Providers**: React context providers for managing authentication, theme, and internationalization. |
43 | | - |
44 | | -## 🚀 Using the Library |
45 | | - |
46 | | -For detailed instructions on how to install and use the components in your project, please refer to the `README.md` file within the specific framework package you are using. |
47 | | - |
48 | | -- **[React Usage Guide](./packages/react/README.md)** |
49 | | - |
50 | | -## 🛠️ Getting Started (for Contributors) |
51 | | - |
52 | | -### Prerequisites |
53 | | - |
54 | | -- Node.js >= 18 |
55 | | -- PNPM (recommended package manager) |
56 | | - |
57 | | -### Installation |
58 | | - |
59 | | -1. **Clone the repository:** |
60 | | - |
61 | | - ```bash |
62 | | - git clone https://github.com/auth0/auth0-ui-components |
63 | | - cd auth0-ui-components |
64 | | - ``` |
65 | | - |
66 | | -2. **Install dependencies:** |
67 | | - |
68 | | - ```bash |
69 | | - pnpm install |
70 | | - ``` |
71 | | - |
72 | | -3. **Build all packages:** |
73 | | - ```bash |
74 | | - pnpm run build |
75 | | - ``` |
76 | | - |
77 | | -### Development |
78 | | - |
79 | | -#### Local Development Workflow |
80 | | - |
81 | | -To make and test changes locally: |
82 | | - |
83 | | -1. Make your desired changes in any of the packages (e.g., `packages/core` or `packages/react`). |
84 | | -2. Re-build all packages to apply your changes: |
85 | | - ```bash |
86 | | - pnpm run build |
87 | | - ``` |
88 | | -3. Navigate to a technology-specific example application in the `examples/` directory (e.g., `examples/react-spa-npm`). |
89 | | -4. Configure the required environment variables in a `.env` file as per the example's `README`. |
90 | | -5. Start the development server to see your changes in action: |
91 | | - ```bash |
92 | | - pnpm run dev |
93 | | - ``` |
94 | | -
|
95 | | -#### Testing |
96 | | -
|
97 | | -Running tests: |
| 20 | +## Quick Start |
98 | 21 |
|
99 | 22 | ```bash |
100 | | -pnpm run test |
101 | | -pnpm run test:react |
102 | | -pnpm run test:core |
| 23 | +npm install @auth0/universal-components-react @auth0/auth0-react react-hook-form |
103 | 24 | ``` |
104 | 25 |
|
105 | | -To run a specific test, go to the relevant package folder and run: |
106 | | -
|
107 | | -```bash |
108 | | -pnpm run test organization-details-edit |
| 26 | +### 1. Wrap Your App with Providers |
| 27 | + |
| 28 | +```tsx |
| 29 | +import { Auth0Provider } from '@auth0/auth0-react'; |
| 30 | +import { Auth0ComponentProvider } from '@auth0/universal-components-react/spa'; |
| 31 | +import '@auth0/universal-components-react/styles'; |
| 32 | + |
| 33 | +function App() { |
| 34 | + return ( |
| 35 | + <Auth0Provider |
| 36 | + domain="your-tenant.auth0.com" |
| 37 | + clientId="your-client-id" |
| 38 | + authorizationParams={{ redirect_uri: window.location.origin }} |
| 39 | + interactiveErrorHandler="popup" // Required to handle step-up auth challenges via Universal Login popup |
| 40 | + > |
| 41 | + <Auth0ComponentProvider themeSettings={{ theme: 'default', mode: 'light' }}> |
| 42 | + {/* Your app */} |
| 43 | + </Auth0ComponentProvider> |
| 44 | + </Auth0Provider> |
| 45 | + ); |
| 46 | +} |
109 | 47 | ``` |
110 | 48 |
|
111 | | -#### Shadcn Local Development |
112 | | -
|
113 | | -1. Update `registry.json` with your changes. |
| 49 | +### 2. Use a Component |
114 | 50 |
|
115 | | -2. Create a new build based on `registry.json`: |
| 51 | +```tsx |
| 52 | +import { SsoProviderCreate } from '@auth0/universal-components-react/spa'; |
116 | 53 |
|
117 | | - ```bash |
118 | | - pnpm build:shadcn |
119 | | - ``` |
120 | | -
|
121 | | -3. Open `docs-site` and serve the registry: |
122 | | -
|
123 | | -```bash |
124 | | -cd docs-site |
125 | | -pnpm install |
126 | | -pnpm run dev |
| 54 | +function SettingsPage() { |
| 55 | + return <SsoProviderCreate />; |
| 56 | +} |
127 | 57 | ``` |
128 | 58 |
|
129 | | -4. Go to your app (e.g., `react-spa-shadcn`) and update the components: |
130 | | -
|
131 | | - ```bash |
132 | | - npx shadcn@latest add http://localhost:5173/r/my-account/user-mfa-management.json --overwrite |
133 | | - npx shadcn@latest add http://localhost:5173/r/my-organization/organization-details-edit.json --overwrite |
134 | | - # ... other components |
135 | | - ``` |
| 59 | +[Read the full documentation →](https://auth0.com/docs/get-started/universal-components/universal-components-overview) |
136 | 60 |
|
137 | | - _Note: The port may differ if other applications are running._ |
| 61 | +## Documentation |
138 | 62 |
|
139 | | -## 📚 Component Reference |
| 63 | +- [Universal Components Overview](https://auth0.com/docs/get-started/universal-components/universal-components-overview) - available components, installation, and configuration |
| 64 | +- [Styling Guide](https://auth0.com/docs/get-started/universal-components/universal-components-style) - theming, CSS variables, and dark mode |
| 65 | +- [Build a Delegated Admin](https://auth0.com/docs/get-started/universal-components/my-organization/build-delegated-admin) - end-to-end setup guide |
| 66 | +- [TypeDoc Reference](https://auth0.github.io/auth0-ui-components/) - TypeDoc-generated source documentation |
| 67 | +- [Examples](https://github.com/auth0/auth0-ui-components/tree/main/examples) - sample applications for React SPA, React shadcn, and Next.js |
| 68 | +- [Auth0 Docs](https://auth0.com/docs) - explore our docs site and learn more about Auth0 |
140 | 69 |
|
141 | | -Explore public components available in @auth0/universal-components-react. |
| 70 | +## Packages |
142 | 71 |
|
143 | | -- [UserMfaManagement](https://auth0.github.io/auth0-ui-components/variables/public-api.UserMFAMgmt.html) |
144 | | -- [DomainTable](https://auth0.github.io/auth0-ui-components/variables/public-api.DomainTable.html) |
145 | | -- [SsoProviderCreate](https://auth0.github.io/auth0-ui-components/variables/public-api.SsoProviderCreate.html) |
146 | | -- [SsoProviderEdit](https://auth0.github.io/auth0-ui-components/variables/public-api.SsoProviderEdit.html) |
147 | | -- [SsoProviderTable](https://auth0.github.io/auth0-ui-components/variables/public-api.SsoProviderTable.html) |
148 | | -- [OrganizationDetailsEdit](https://auth0.github.io/auth0-ui-components/variables/public-api.OrganizationDetailsEdit.html) |
| 72 | +| Package | Description | |
| 73 | +| ------------------------------------------------------ | ----------------------------------------------------- | |
| 74 | +| [@auth0/universal-components-react](./packages/react/) | React components with `/spa` and `/rwa` entry points | |
| 75 | +| [@auth0/universal-components-core](./packages/core/) | Framework-agnostic core utilities, services, and i18n | |
149 | 76 |
|
150 | | -## 🤝 Contributing |
| 77 | +## Feedback |
151 | 78 |
|
152 | | -Contributions are welcome! Please feel free to submit a pull request or open an issue for any bugs, feature requests, or improvements. |
| 79 | +- [Raise an issue](https://github.com/auth0/auth0-ui-components/issues) - Report bugs or request features |
| 80 | +- [Contributing Guide](./CONTRIBUTING.md) - Local development setup |
| 81 | +- [Vulnerability Reporting](https://auth0.com/responsible-disclosure-policy) - Security issues |
153 | 82 |
|
154 | | -## 📜 License |
| 83 | +## License |
155 | 84 |
|
156 | | -Copyright 2026 Okta, Inc |
| 85 | +Copyright 2026 Okta, Inc. Licensed under [Apache License 2.0](LICENSE). |
157 | 86 |
|
158 | | -This project is licensed under the [Apache License 2.0](LICENSE). See the [LICENSE](LICENSE) file for details. |
| 87 | +--- |
159 | 88 |
|
160 | | -**Authors** |
161 | | -Okta Inc. |
| 89 | +<p align="center"> |
| 90 | + <picture> |
| 91 | + <source media="(prefers-color-scheme: light)" srcset="https://cdn.auth0.com/website/sdks/logos/auth0_light_mode.png" width="150"> |
| 92 | + <source media="(prefers-color-scheme: dark)" srcset="https://cdn.auth0.com/website/sdks/logos/auth0_dark_mode.png" width="150"> |
| 93 | + <img alt="Auth0 Logo" src="https://cdn.auth0.com/website/sdks/logos/auth0_light_mode.png" width="150"> |
| 94 | + </picture> |
| 95 | +</p> |
| 96 | +<p align="center">Auth0 is an easy to implement, adaptable authentication and authorization platform. To learn more checkout <a href="https://auth0.com/why-auth0">Why Auth0?</a></p> |
0 commit comments