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.
PrimerSpacingTokens is the spacing scale Primer’s components use for padding and the gaps between elements. You override it per mode in the theme prop of PrimerCheckoutProvider, under light.spacing and dark.spacing. Both take Partial<PrimerSpacingTokens>, so you set only the steps you want to change.
Values are numbers in React Native layout units. The defaults are the same in light and dark mode.

Tokens

Input field height

An input field’s minimum height is 2 × spacing.medium + typography.bodyLarge.lineHeight, and never less than 44. At the defaults it is 44. With medium: 16 it is 52, and with medium: 8 it stays 44. The border is drawn inside the field, so a thicker border reduces the padding instead of adding height. To set the height of one input, use the fieldHeight key of its PrimerTextInputTheme. That value is used as given, without the 44 minimum. Buttons and payment method rows keep a minimum height of 44, whatever the spacing.

Override spacing

Spacing steps form a scale. Change neighboring steps together to keep the rhythm even. Share one object between both modes:
Pass theme to PrimerCheckoutProvider. These tokens set the spacing inside Primer’s components only. The space around them is part of your own layout. To use the same scale in your own components, read it with usePrimerTheme:

See also

PrimerThemeOverride

Apply a theme, choose light or dark mode and read tokens with usePrimerTheme.

Shape tokens

Corner radii, sizes and border widths.

Typography tokens

The brand font and the six text styles.

Card inputs

Per-input overrides with PrimerTextInputTheme.