Skip to main content
Align the checkout form with your brand and design system. Consistent styling improves user trust, reduces friction, and keeps the experience accessible across devices. The PayNext SDK supports two complementary approaches:
  • CSS-in-JS: Apply React CSSProperties directly for precise control
  • CSS classes: Use custom classes for state styling, animations, and responsive design

CSS-in-JS Styling

Direct React CSS properties for precise control over form elements.

CSS Class Names

Custom classes for advanced styling with pseudo-selectors and responsive design.

Implement Brand Styles

Integrate the checkout form with your design system using CSS custom properties:
Prefer CSS custom properties (var(...)) to keep styles consistent with your design system, enable easy theming, and minimize code changes.
CSS custom properties enable dynamic theming without JavaScript and generally perform better than heavy inline style changes.

Configure StylesConfig

The StylesConfig interface provides styling options for all checkout form elements.
Define your StylesConfig objects and pass them into the styles property when calling checkout.mount('element-id', { ...config, styles }), following the pattern in Mount the Checkout.

Core Elements

InputStyles
Configure card number, expiry, CVC, cardholder name, etc.
ISubmitButtonStyles
Styles for the payment submit button.

Digital Wallet Buttons

IApplePayButtonStyles
Apple Pay button styling following Apple’s guidelines.
IPayPalButtonStyles
PayPal button styling following PayPal specifications.
IGooglePayButtonStyles
Google Pay button styling.
HTMLStyles
Cash App Pay button styling (Stripe wallets only).
Match the default 40px height when possible so the button aligns with other wallet controls. Increase padding for better tap targets on mobile.
HTMLStyles
Styles for generic wallet buttons (e.g., custom wallet implementations).
HTMLStyles
Styles for Braintree payment buttons.

Pix Button

HTMLStyles
Styles for the Pix button in the payment method list. The button shows the Pix icon without a label, so text properties have no effect — use styles for the surface itself: background, border, height, and radius. Defaults are a full-width 40px button with a white background, an #e0e0e0 border, and the theme’s border radius. The dark theme uses a #1a1a1a background with a #333 border.
pix-button.constant.ts

Pix Form

PixFormStyles
Overrides for the Pix form’s embedded Stripe Payment Element — the email, CPF/CNPJ, and name fields, plus the QR code step. Unlike the other elements on this page, these map to Stripe’s Appearance API variables instead of React CSSProperties, since the Pix form renders inside a Stripe-hosted iframe.
Every field is optional — fields you don’t set keep the active theme’s default. Overrides apply to both recurring Pix Automático and one-time Pix, and re-apply immediately if the theme changes while the form is open. See Pix Form Theming.
pix-form.constant.ts
Available from SDK version 1.1.0.
HTMLStyles
Styles for the back button wrapper that sits above the card form (hidden when the default variant hides the control). Defaults include a 30x30px flex container with centered content, a #f4f4f5 background, and 8px border radius.
CSSVariablesConfig
Override the SDK design tokens directly from styles without adding external stylesheets. Values apply to the checkout root element and merge with the active theme.
Leave any variable undefined to keep the theme default. See Theme Support › CSS Variables for the complete token list and defaults.
css-variables.constant.ts
Use cssVariables for theme-level changes and component-level styles for fine-grained control. They work together—component styles take precedence over CSS variables.
Element-level styling properties support both styles (React CSSProperties) and className, while cssVariables overrides global tokens for the entire checkout.
Wallet button styling must also follow each processor’s brand guidelines (Apple, PayPal, Google) to remain compliant.

Target Elements with External CSS

The SDK adds data-paynext-* attributes to key elements, enabling CSS targeting from external stylesheets without modifying JavaScript:
external-styles.css
Combine external CSS with cssVariables for maximum flexibility. Use external CSS for media queries and pseudo-states, and cssVariables for brand tokens.

Use Advanced Styling Patterns

These examples demonstrate real-world styling patterns used by production applications. Each example includes performance optimizations and accessibility considerations.
All examples below show only the StylesConfig object. Pass it to checkout.mount('element-id', { ...config, styles }) as shown in Mount the Checkout.
css-variables-only.constant.ts
CSS variables are the simplest way to customize the checkout. Use them for theme-level changes without touching component styles.

Review Complete Styling Example

Here’s a comprehensive example that demonstrates styling all available components. This configuration is production-ready and includes:
  • Accessibility compliance: standards
  • Performance optimization: Hardware-accelerated transitions
  • Cross-browser compatibility: Tested across major browsers
  • Mobile responsiveness: Touch-friendly targets and spacing
complete-styling.constant.ts
This production-ready example includes compliance: 16px min text, 44px touch targets, ≥4.5:1 contrast, and visible focus states.

Apply Best Practices

Use CSS custom properties for design system integration, enabling centralized management, easy theme switching, and team collaboration. For theme-level tokens, prefer cssVariables over inline styles.
For older browsers, provide fallback values: backgroundColor: 'var(--color-primary, #3b82f6)'

Follow Common Styling Patterns

Responsive Design

Design your checkout form with mobile users in mind first, then enhance for larger screens:
mobile-first.constant.ts
Ensure your styling meets accessibility standards:
accessible.constant.ts
quick checks: 16px min text, ≥4.5:1 contrast, visible focus ring, 44px touch targets, no color-only semantics.
Optimize your styles for better performance:
optimized.constant.ts

Brand Integration

Color Consistency

Use your brand colors consistently across all payment elements to maintain visual cohesion.

Typography Matching

Match your website’s typography by using the same font families and weights in the checkout form.

Border Radius

Maintain consistent border radius values that match your site’s design language.

Animation Timing

Use consistent transition durations (typically 0.2s-0.3s) for a cohesive user experience.

Common Styling Patterns

dark-mode.constant.ts
Prefer cssVariables for dark mode. See Theme Support for more presets.