Auth UI
Auth UI is a pre-built React component for authenticating users. It supports custom themes and extensible styles to match your brand and aesthetic.
Set up Auth UI#
Install the latest version of supabase-js and the Auth UI package:
_10npm install @supabase/supabase-js @supabase/auth-ui-react @supabase/auth-ui-shared
Import the Auth component#
Pass supabaseClient
from @supabase/supabase-js
as a prop to the component.
This renders the Auth component without any styling.
We recommend using one of the predefined themes to style the UI.
Import the theme you want to use and pass it to the appearance.theme
prop.
Social Providers#
The Auth component also supports login with official social providers.
Options#
Options are available via queryParams
:
_10<Auth_10 supabaseClient={supabase}_10 providers={['google']}_10 queryParams={{_10 access_type: 'offline',_10 prompt: 'consent',_10 hd: 'domain.com',_10 }}_10 onlyThirdPartyProviders={true}_10/>
Supported Views#
The Auth component is currently shipped with the following views:
- Email Login
- Magic Link login
- Social Login
- Update password
- Forgotten password
We are planning on adding more views in the future. Follow along on that repo.
Customization#
There are several ways to customize Auth UI:
- Use one of the predefined themes that comes with Auth UI
- Extend a theme by overriding the variable tokens in a theme
- Create your own theme
- Use your own CSS classes
- Use inline styles
- Use your own labels
Predefined themes#
Auth UI comes with several themes to customize the appearance. Each predefined theme comes with at least two variations, a default
variation, and a dark
variation. You can switch between these themes using the theme
prop. Import the theme you want to use and pass it to the appearance.theme
prop.
info
Currently there is only one predefined theme available, but we plan to add more.
Switch theme variations#
Auth UI comes with two theme variations: default
and dark
. You can switch between these themes with the theme
prop.
If you don't pass a value to theme
it uses the "default"
theme. You can pass "dark"
to the theme prop to switch to the dark
theme. If your theme has other variations, use the name of the variation in this prop.
Override themes#
Auth UI themes can be overridden using variable tokens. See the list of variable tokens.
If you created your own theme, you may not need to override any of the them.
Create your own theme #
You can create your own theme by following the same structure within a appearance.theme
property.
See the list of tokens within a theme.
You can swich between different variations of your theme with the "theme" prop.
Custom CSS classes #
You can use custom CSS classes for the following elements:
"button"
, "container"
, "anchor"
, "divider"
, "label"
, "input"
, "loader"
, "message"
.
Custom inline CSS #
You can use custom CSS inline styles for the following elements:
"button"
, "container"
, "anchor"
, "divider"
, "label"
, "input"
, "loader"
, "message"
.
Custom labels #
You can use custom labels with localization.variables
. See the list of labels that can be overwritten.
Currently, translating error messages (e.g. "Invalid credentials") is not supported. Check related issue.