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)
Custom button styles in styles.ApplePayButton, styles.GooglePayButton, styles.PayPalButton, or styles.PixButton 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.

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 apply your own focus styles via component styling or external CSS.

Override from External CSS

Target the .checkout class from your stylesheet:
styles.css

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.