Apply colors, typography, spacing and dark mode with CSS variables on Web, PrimerTheme on Android, PrimerCheckoutTheme on iOS and PrimerThemeOverride on React Native.
Primer Checkout is fully customizable. You can customize colors, typography, spacing, borders, and component layout (down to the smallest visual detail) without touching internal component code or breaking upgrades.
Styling methods
Web
Android
iOS
React Native
On the web, Primer Checkout uses CSS variables for theming. You can apply styling in two ways - directly in your CSS or through component attributes.
On React Native, Primer Checkout uses PrimerThemeOverride for theming. Pass a custom theme, with tokens for light mode, dark mode or both, to the theme prop of PrimerCheckoutProvider:
Define the theme outside your component, or build it with useMemo, so the provider doesn’t merge it again on every render. Values under light apply in light mode only. See Theme support.
This approach is particularly useful when working with JavaScript frameworks or when you need to apply styling variables programmatically.The component will parse the JSON and automatically apply the styles as CSS Variables internally.
Set brand in TypographyOverrides to one font family name that your app can load, such as a system font or a font you bundle. The default is Inter. Font weights use Font.Weight steps, such as .regular, .medium, .semibold and .bold.See the Design Tokens Explorer to preview how tokens affect the checkout, and the Theming reference for the complete list of PrimerCheckoutTheme tokens.
PrimerThemeOverride has a light and a dark block. Each takes the same six optional token groups:
Group
Key
Type
Controls
Colors
colors
Partial<PrimerColorTokens>
Brand, text, backgrounds, borders, icons, focus, loader and the sheet backdrop
Spacing
spacing
Partial<PrimerSpacingTokens>
Padding and gaps, from xxsmall to xxlarge
Typography
typography
PrimerTypographyOverride
Brand font, and the size, weight, line height and letter spacing of six text styles
Radii
radii
Partial<PrimerRadiusTokens>
Corner radius for inputs, buttons and the sheet
Sizes
sizes
Partial<PrimerSizeTokens>
The size scale, from small to xxxlarge
Border widths
widths
Partial<PrimerWidthTokens>
Border widths for the default, focus, selected and error states
Pass theme to PrimerCheckoutProvider. Setting brand also moves focus, loader and the focus and selected borders, unless you set them yourself. See Tokens that follow others.Set typography.fontFamily to one font family name that your app registers. The default is Inter, which the SDK bundles. Font weights are strings from '100' to '900', such as '400' and '600'.See the Design Tokens Explorer to preview how tokens affect the checkout, and the Color, Spacing, Typography and Shape token pages for the complete list of PrimerThemeOverride tokens.
Theme support
Primer Checkout supports both light and dark themes.
Web
Android
iOS
React Native
The default option is light. Set appearanceMode to 'DARK' to use the dark theme, or to 'SYSTEM' to follow the browser’s colour scheme. The checkout has no background of its own, so use these only on a page that is dark too or follows the same setting:
checkout.options = { appearanceMode: 'SYSTEM'};
You can also pass a primer-dark-theme CSS class yourself:
DarkColorTokens extends LightColorTokens and overrides base color values. Semantic tokens automatically resolve to the correct values through inheritance:
By default the checkout follows the system theme. Set appearanceMode to PrimerAppearanceMode.LIGHT or PrimerAppearanceMode.DARK to pin it to one appearance.
val theme = PrimerTheme( lightColorTokens = object : LightColorTokens() { override val primerColorBrand: Color = Color(0xFFE53E3E) override val primerColorBackgroundPrimary: Color = Color(0xFFF8F8F8) }, darkColorTokens = object : DarkColorTokens() { override val primerColorBrand: Color = Color(0xFFFF6B6B) }, appearanceMode = PrimerAppearanceMode.SYSTEM,)
PrimerTheme automatically maps color tokens to a Material 3 ColorScheme. Material components used within the checkout (like ModalBottomSheet) inherit your Primer color tokens without additional configuration.
The checkout follows the system appearance, or the mode you force with PrimerUIOptions(appearanceMode: .light) or .dark. colors applies in light mode only and darkColors in dark mode only. Any color you leave out of darkColors uses Primer’s dark default, not the value from colors. To keep a color in dark mode, set it in darkColors as well:
let theme = PrimerCheckoutTheme( colors: ColorOverrides( primerColorBrand: Color("BrandColor"), // Asset catalog color, light appearance primerColorBackgroundPrimary: Color(.systemBackground) // Resolves to its light value ), darkColors: ColorOverrides( primerColorBrand: Color("BrandColor"), // Same asset, dark appearance primerColorBackgroundPrimary: Color(.systemBackground) // Resolves to its dark value ))
Each color resolves for the appearance being drawn. An adaptive color, such as an asset catalog color, Color(.label) or Color(.systemBackground), gives its light value in colors. In darkColors it gives its dark value. Pass the same adaptive color in both to get both variants. radius, spacing, sizes, typography and width are the same in light and dark mode.
The checkout follows the device’s light or dark setting, or the mode you force with settings.uiOptions.appearanceMode set to 'LIGHT' or 'DARK'. 'SYSTEM', the same as leaving it unset, follows the device. theme.light applies in light mode only and theme.dark in dark mode only. Any token you leave out of dark uses Primer’s dark default, not the value from light. To keep a value in dark mode, set it in dark as well: