Customize Style and Themes for iOS Universal Components
Learn how to customize style and themes for Universal Components on iOS.
Auth0 Universal Components for iOS use a design token model. Visual properties such as colors, typography, spacing, corner radii, and component sizes are each expressed as a token that you can override without changes to your layouts.Universal Components ship with a default Auth0 theme. You can provide your own theme to match your brand.
Universal Components for iOS use a SwiftUI @Environment property wrapper theme. Apply the .auth0Theme(_:) modifier to any SwiftUI view. Every child component renders the injected Auth0Theme automatically.
If you do not configure a theme, Universal Components for iOS render the Auth0 default theme. The following example displays the MyAccountAuthMethodsView component without any customization:
import SwiftUIimport Auth0UniversalComponentsstruct ContentView: View { var body: some View { MyAccountAuthMethodsView() }}
No additional setup is required to load the Auth0 default theme. Universal Components apply it automatically when no custom theme is provided.
You can override specific tokens while Universal Components for iOS render every other token using the Auth0 default theme.The following example overrides only the primary background and text colors:
Provide your own branding theme that implements the three color category properties, then wire them into an Auth0ColorTokens container:
struct BrandBackground: Auth0BackgroundColorTokens { var primary: Color { Color("Background/Primary", bundle: .main) } var primarySubtle: Color { Color("Background/Primary", bundle: .main).opacity(0.35) } var inverse: Color { Color("Background/Inverse", bundle: .main) } var accent: Color { Color("Background/Accent", bundle: .main) } var layerTop: Color { Color("Background/LayerTop", bundle: .main) } var layerMedium: Color { Color("Background/LayerMedium", bundle: .main) } var layerBase: Color { Color("Background/LayerBase", bundle: .main) } var error: Color { Color("Background/Error", bundle: .main) } var errorSubtle: Color { Color("Background/ErrorSubtle", bundle: .main).opacity(0.35) } var success: Color { Color("Background/Success", bundle: .main) } var successSubtle: Color { Color("Background/SuccessSubtle", bundle: .main) }}struct BrandColors: Auth0ColorTokens { var background: any Auth0BackgroundColorTokens { BrandBackground() } var text: any Auth0TextColorTokens { DefaultAuth0TextColorTokens() } var border: any Auth0BorderColorTokens { DefaultAuth0BorderColorTokens() }}MyAccountAuthMethodsView() .auth0Theme(Auth0Theme(colors: BrandColors()))
Colors are split across three focused protocols: Auth0BackgroundColorTokens, Auth0TextColorTokens, and Auth0BorderColorTokens. These are aggregated into the Auth0ColorTokens protocol.All color assets are adaptive. The asset catalog handles light and dark mode automatically.Background primary
Token
Usage
background.primary
CTA button background, primary borders
background.primarySubtle
Low-emphasis primary background
background.inverse
Contrast-flipped background
background.accent
Branded or featured UI highlight
Background layers
Token
Usage
background.layerTop
Overlays and modals
background.layerMedium
Cards and raised containers
background.layerBase
Main app background
Background feedback
Token
Usage
background.error
Error state container
background.errorSubtle
Subtle error banner
background.success
Success state container
background.successSubtle
Subtle success banner
Text content
Token
Usage
text.bold
Headings and primary body text
text.regular
Secondary copy, descriptions, captions
text.disabled
Disabled and placeholder text
Text on color surfaces
Token
Usage
text.onPrimary
Text and icons on background.primary
text.onSuccess
Text and icons on background.success
text.onError
Text and icons on background.error, validation messages
Border
Token
Usage
border.bold
High-contrast or selected borders
border.regular
Input field and card borders
border.subtle
Delicate dividers
border.shadow
Elevation shadow border
Typography — Auth0TypographyTokens
Each token is an Auth0TextStyle bundling font, tracking, and lineSpacing. Apply them using the .auth0TextStyle(_:) view modifier.
Token
Typeface
Size
Weight
Line height
Tracking
Usage
displayLarge
Inter
34 pt
SemiBold
41 pt
−0.20 pt
Hero headings, passkey enrollment
displayMedium
Inter
28 pt
SemiBold
34 pt
−0.10 pt
Major screen titles, error headings
display
Inter
22 pt
SemiBold
28 pt
−0.05 pt
Section-level headings
titleLarge
Inter
20 pt
SemiBold
25 pt
0 pt
Screen titles, subheading cards
title
Inter
17 pt
SemiBold
24 pt
0 pt
In-content titles
body
Inter
17 pt
Regular
24 pt
0 pt
Descriptions, body copy
bodySmall
Inter
15 pt
Regular
20 pt
+0.10 pt
Secondary body copy, footnotes
label
Inter
16 pt
Medium
21 pt
+0.10 pt
Button labels, form field labels
helper
Inter
13 pt
Regular
18 pt
+0.20 pt
Captions, helper text
overline
Inter
11 pt
Regular
16 pt
+0.77 pt
Overline and category labels
If typeface Inter is not bundled in the host application, SwiftUI uses the SF Pro typeface automatically.
Spacing — Auth0SpacingTokens
Spacing defaults to a 4 pt grid. Use the token name in design handoffs to customize spacing, not the raw pixel value.