> ## Documentation Index
> Fetch the complete documentation index at: https://primer.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Typography tokens

> The brand font and the six text styles Primer Checkout components use in React Native.

> [!WARNING]
>
> Primer Checkout React Native SDK is currently in **beta** (v3.0.0-beta.1).
> The API is subject to change before the stable release.

`PrimerTypographyTokens` holds the brand font and the six text styles that Primer's components use. You override them per mode in the [`theme`](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/theming/primer-theme-override) prop of `PrimerCheckoutProvider`, under `light.typography` and `dark.typography`. Both take a `PrimerTypographyOverride`, in which every field is optional.

## PrimerTypographyTokens

The resolved tokens, as [`usePrimerTheme`](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/theming/primer-theme-override#useprimertheme) returns them.

```tsx theme={"dark"}
interface PrimerTypographyTokens {
  fontFamily: string;
  titleXlarge: PrimerTypographyStyle;
  titleLarge: PrimerTypographyStyle;
  bodyLarge: PrimerTypographyStyle;
  bodyMedium: PrimerTypographyStyle;
  bodySmall: PrimerTypographyStyle;
  error: PrimerTypographyStyle;
}
```

`fontFamily` is the brand font. Every style uses it unless the style names its own font. The default is Inter, which the SDK bundles and registers for you.

### Defaults

The defaults are the same in light and dark mode. Sizes are in React Native layout units, and every style uses the brand font.

| Style | `fontSize` | `fontWeight` | `lineHeight` | `letterSpacing` | Used for |
| - | - | - | - | - | - |
| `titleXlarge` | 24 | `'500'` | 32 | -0.6 | Screen titles in the sheet. |
| `titleLarge` | 16 | `'500'` | 20 | -0.2 | Button labels, header actions such as Back and Cancel, payment method labels and section titles. |
| `bodyLarge` | 16 | `'400'` | 20 | -0.2 | Text typed into inputs, and status screen titles. |
| `bodyMedium` | 14 | `'400'` | 20 | 0 | Status screen subtitles. |
| `bodySmall` | 12 | `'400'` | 16 | 0 | Input labels and card network badge text. |
| `error` | 12 | `'400'` | 16 | 0 | Field error messages. |

> [!NOTE]
>
> Font weights are strings from `'100'` to `'900'` in steps of 100.

## PrimerTypographyStyle

```tsx theme={"dark"}
interface PrimerTypographyStyle {
  fontSize: number;
  fontWeight: '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
  lineHeight: number;
  letterSpacing: number;
  fontFamily: string;
}
```

| Field | Type | Description |
| - | - | - |
| `fontSize` | `number` | Font size. |
| `fontWeight` | `'100'` to `'900'` | Font weight, as a string. |
| `lineHeight` | `number` | Line height. The `bodyLarge` line height also sets the input field height: `2 × spacing.medium + lineHeight`, never less than 44. |
| `letterSpacing` | `number` | Letter spacing. |
| `fontFamily` | `string` | Font family. In an override, leave it out to keep following the brand font. |

## PrimerTypographyOverride

What you pass under `light.typography` or `dark.typography`.

```tsx theme={"dark"}
interface PrimerTypographyOverride {
  fontFamily?: string;
  titleXlarge?: PrimerTypographyStyleOverride;
  titleLarge?: PrimerTypographyStyleOverride;
  bodyLarge?: PrimerTypographyStyleOverride;
  bodyMedium?: PrimerTypographyStyleOverride;
  bodySmall?: PrimerTypographyStyleOverride;
  error?: PrimerTypographyStyleOverride;
}

type PrimerTypographyStyleOverride = Partial<PrimerTypographyStyle>;
```

| Field | Type | Description |
| - | - | - |
| `fontFamily` | `string` | Brand font. Changes every style that doesn't set its own `fontFamily`. |
| `titleXlarge`, `titleLarge`, `bodyLarge`, `bodyMedium`, `bodySmall` | `PrimerTypographyStyleOverride` | The fields to change on that style. Fields you leave out keep their default. |
| `error` | `PrimerTypographyStyleOverride` | The fields to change on field error text. Any field you leave out follows your `bodySmall` override, then the default. |

How the override merges:

* Set `fontFamily` once to change the typeface of the whole checkout.
* Set `fontFamily` on one style to change only that style.
* Set one field on a style, such as `fontSize`, and the other fields keep their defaults.
* A field you set on `bodySmall` also applies to `error`, unless you set the same field on `error`.

## Override typography

```tsx theme={"dark"}
import type { PrimerThemeOverride, PrimerTypographyOverride } from '@primer-io/react-native';

const typography: PrimerTypographyOverride = {
  fontFamily: 'Poppins',
  titleXlarge: { fontSize: 28, lineHeight: 36, fontWeight: '700' },
  bodySmall: { fontSize: 13 },
  error: { fontWeight: '600' },
};

const theme: PrimerThemeOverride = {
  light: { typography },
  dark: { typography },
};
```

In this example, error text gets font size 13 from the `bodySmall` override and weight `'600'` from its own.

Register your own font in your app as you would any React Native font, then set its family name as `fontFamily`. Primer passes `fontFamily` to React Native as it is.

To restyle the text of a single input, use the typography keys of its `PrimerTextInputTheme` instead. See [Card inputs](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/card-form/card-inputs.md).

## See also

> [card] [PrimerThemeOverride](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/theming/primer-theme-override.md)
>
> Apply a theme, choose light or dark mode and read tokens with usePrimerTheme.

> [card] [Color tokens](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/theming/color-tokens.md)
>
> All 32 colors with their light and dark defaults.

> [card] [Spacing tokens](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/theming/spacing-tokens.md)
>
> The padding and gap scale.

> [card] [Card inputs](https://primer.io/docs/sdk/react-native-checkout/v3.0.0-beta/api/card-form/card-inputs.md)
>
> Per-input overrides with PrimerTextInputTheme.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.