Skip to main content

Theme Configuration

Provide the theme property on the object you pass into checkout.mount('element-id', { ...config }) after creating the instance with new PayNextCheckout(), as shown in Mount the Checkout.
'light' | 'dark' | 'system'
Theme mode for the checkout UI.
  • 'light': Fixed light theme
  • 'dark': Fixed dark theme
  • 'system': Resolves to browser’s prefers-color-scheme at mount time, then fixed
  • undefined: Defaults to 'light' and listens for system theme changes
When theme is undefined, the SDK automatically updates when the user changes their system theme preference. When explicitly set (including 'system'), the theme is fixed and does not listen to system changes.

Payment Button Styling

Payment buttons automatically adapt to the theme:
  • Apple Pay: style: 'black' (light) / 'white' (dark)
  • Google Pay: color: 'black' (light) / 'white' (dark)
  • PayPal: color: 'gold' (light) / 'white' (dark)
  • Pix: white background with an #e0e0e0 border (light) / #1a1a1a background with a #333 border (dark)
  • BLIK: black background and border in both themes (the BLIK mark is white on black); the dark theme only softens the border to #333
Custom button styles in styles.ApplePayButton, styles.GooglePayButton, styles.PayPalButton, styles.PixButton, or styles.BlikButton override theme defaults.

Pix Form Theming

Available from SDK version 1.1.0.
The Pix form’s embedded Stripe Payment Element — the email, CPF/CNPJ, and name fields, plus the QR code step — follows the checkout’s light/dark theme automatically. No configuration is required.
  • Light theme: white field background, dark text
  • Dark theme: dark field background, light text
Both themes share the same accent color and remove Stripe’s default focus shadow, so the Pix form matches the rest of the checkout’s flat input style.
Changing the theme at runtime (checkout.update({ theme })) re-themes an already-open Pix form immediately — you don’t need to close and reopen it.

Custom Pix Form Colors

Override individual colors and the border radius with styles.PixForm (type PixFormStyles). These map to Stripe’s Appearance API variables, not the --paynext-sdk-* tokens below, since the Pix form renders inside a Stripe-hosted iframe.
pix-form-theme.ts
Fields you don’t set keep the active theme’s default, and overrides apply to both recurring Pix Automático and one-time Pix. See PixForm for the complete field reference.

BLIK Form Theming

Available from SDK version 1.2.0.
The BLIK form’s embedded Stripe Payment Element, where the customer enters the six-digit code from their banking app, follows the checkout’s light/dark theme automatically. No configuration is required, and it behaves exactly like the Pix form above: the same light/dark field treatment, the same accent color, and no Stripe focus shadow.
Changing the theme at runtime (checkout.update({ theme })) re-themes an already-open BLIK form immediately — you don’t need to close and reopen it.

Custom BLIK Form Colors

Override individual colors and the border radius with styles.BlikForm (type BlikFormStyles, the same shape as PixFormStyles). These map to Stripe’s Appearance API variables, not the --paynext-sdk-* tokens below, since the BLIK form renders inside a Stripe-hosted iframe.
blik-form-theme.ts
Fields you don’t set keep the active theme’s default. They apply to the form where a new BLIK payment is entered; a saved BLIK payment method is charged from the saved-method row without that form. See BlikForm for the complete field reference.

CSS Variables

Override theme tokens by passing styles.cssVariables (type CSSVariablesConfig) when you mount the SDK, or target .checkout / .checkout.dark classes from your stylesheet. Unset values fall back to the active theme defaults.
Variables marked “inherits” are not redefined in dark mode and use the light theme value. Variables marked “same” are explicitly set to the same value in both themes.

Complete Token Reference

Override from Config

Pass cssVariables through the styles option when mounting:
config-override.ts
Set --paynext-sdk-input-focus-shadow to none to disable the default teal focus ring, and use --paynext-sdk-border-focus to color the focused field’s border instead.

Override per Theme

The checkout renders inside an iframe, so your page’s stylesheets can’t override its variables. Set them in cssVariables instead. The values you pass apply in both themes, and styles can’t change after mount. To use different values for light and dark, pick the set that matches the theme when you mount:
theme-overrides.ts
Custom cssVariables don’t follow a theme change after mount. checkout.update({ theme }) and the automatic switch when theme is undefined change only the built-in theme values, so your tokens for the previous theme stay applied. If your page switches themes while the checkout is open, unmount it and mount it again with the matching token set:
Remounting resets the form, so anything the customer has typed is cleared.

Style Presets

Create reusable style presets for different design systems:
minimal-preset.ts

TypeScript Reference

The SDK exports full type definitions for theme configuration:
types.ts
All CSSVariablesConfig properties are optional. Only override the tokens you need to change.