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.Theme mode for the checkout UI.
'light': Fixed light theme'dark': Fixed dark theme'system': Resolves to browser’sprefers-color-schemeat mount time, then fixedundefined: 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)
styles.ApplePayButton, styles.GooglePayButton, or styles.PayPalButton override theme defaults.
CSS Variables
Override theme tokens by passingstyles.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
| Variable | Light default | Dark default | Description |
|---|---|---|---|
--paynext-sdk-bg | transparent | transparent | Checkout container background |
--paynext-sdk-text | #1a1a1a | #ffffff | Primary text color |
--paynext-sdk-border | #e0e0e0 | #404040 | Default border color |
--paynext-sdk-border-focus | #6b7280 | #9ca3af | Border color on focus |
--paynext-sdk-border-radius | 12px | inherits | Global border radius |
--paynext-sdk-input-bg | transparent | transparent | Input field background |
--paynext-sdk-input-text | hsla(0, 0%, 10%, 0.9) | hsla(0, 0%, 90%, 0.9) | Input text color |
--paynext-sdk-input-focus-shadow | 0 0 0 1px rgba(13, 118, 110, 0.7), 0 1px 1px 0 rgba(0, 0, 0, 0.07), 0 0 0 4px rgba(13, 118, 110, 0.3) | same | Focus ring/shadow |
--paynext-sdk-placeholder | #9ca3af | #6b7280 | Placeholder text color |
--paynext-sdk-error | #ef4444 | #f87171 | Error text color |
--paynext-sdk-error-border | #dc2727 | #f87171 | Error border color |
--paynext-sdk-disabled-bg | #ebedef | #374151 | Disabled input background |
--paynext-sdk-disabled-text | #9ca3af | #6b7280 | Disabled input text |
--paynext-sdk-button-bg | #0d766e | #0d766e | Submit button background |
--paynext-sdk-button-hover-bg | #0d766d25 | inherits | Button hover background |
--paynext-sdk-button-text | #ffffff | #ffffff | Button text color |
--paynext-sdk-button-hover-opacity | 0.7 | 0.8 | Button hover opacity |
--paynext-sdk-card-bg | #252525 | #ffffff | Card icon container |
--paynext-sdk-card-icon | #565656 | #d1d5db | Card icon color |
Override from Config
PasscssVariables through the styles option when mounting:
config-override.ts
Override from External CSS
Target the.checkout class from your stylesheet:
styles.css
Style Presets
Create reusable style presets for different design systems:- Minimal
- Colorful
- Brand Colors
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.