Skip to main content
Primer Checkout React Native SDK is currently in beta (v3.0.0-beta.1). The API is subject to change before the stable release.
PrimerThemeOverride is the type of the theme prop on PrimerCheckoutProvider. It holds design-token overrides for light mode and dark mode, and every Primer component inside the provider draws with the result. The SDK ships a default set of tokens for each mode. Your light overrides are merged onto the light defaults and your dark overrides onto the dark defaults, one key at a time. You set only the tokens you want to change. A token you leave out keeps its default, except that some colors follow another color you set. See Tokens that follow others.

Type

Token groups

Each mode takes the same six optional groups.

Apply a theme

Pass the theme to PrimerCheckoutProvider. It styles every Primer component inside the provider: PrimerCheckoutSheet, and the components you compose in a custom layout.
Define the theme outside your component, or build it with useMemo. The provider merges the tokens again each time it receives a new light or dark object, so a theme written inline in JSX is merged again on every render. To switch themes at runtime, pass a new object: the components restyle on the next render.

Values the SDK ignores

  • null or undefined keeps the default for that token.
  • A NaN or infinite number keeps the default, and the SDK logs the warning [PrimerCheckoutTheme] A NaN or infinite theme number is ignored.

Light and dark mode

Set settings.uiOptions.appearanceMode on the provider to choose which set of tokens applies. When the device reports no preference, the checkout uses light mode. The provider reads appearanceMode on every render, so a change applies right away.

usePrimerTheme

Returns the tokens in effect: the defaults for the active mode with your overrides merged in. Use it to style your own UI, such as a custom Pay button, so it matches Primer’s components. Inside a PrimerCheckoutProvider, the result follows your theme and appearanceMode. Outside one, it returns the default tokens for the device’s light or dark setting, without your overrides and without appearanceMode. Primer components that can render outside a provider, such as the status screens, use those defaults too.

Returns

PrimerTokens:

Example

Fonts

Every text style uses the brand font, typography.fontFamily, unless the style sets its own. The default is Inter. It ships inside the package and the SDK registers it, so it needs no setup. To use your own font, register it in your app as you would any React Native font, then set its family name as typography.fontFamily under both light and dark. See Typography tokens.

Per-input overrides

Each Primer input also takes a theme prop of type PrimerTextInputTheme, which overrides the tokens for that one input. See Card inputs.

Exported types

Import these with import type { ... } from '@primer-io/react-native'.

See also

Color tokens

All 32 colors with their light and dark defaults.

Typography tokens

The brand font and the six text styles.

Spacing tokens

The padding and gap scale.

Shape tokens

Corner radii, sizes and border widths.