FloPay
Guides

Theming

Customize the appearance of FloPay payment elements with themes and CSS variables.

Theming

FloPay provides a FloPayAppearance configuration that controls the visual style of payment elements. Three built-in themes are available, and you can customize individual variables.

Built-in Themes

DEFAULT_APPEARANCE

import { DEFAULT_APPEARANCE } from '@flopay/shared';
 
// {
//   theme: 'default',
//   variables: {
//     colorPrimary: '#4A49FF',
//     colorBackground: '#FFFFFF',
//     colorText: '#262833',
//     colorDanger: '#DF1B41',
//     borderRadius: '8px',
//     fontFamily: 'Poppins, system-ui, sans-serif',
//     fontSizeBase: '16px',
//     spacingUnit: '4px',
//   },
// }

FLAT_APPEARANCE

Minimal borders and shadows with tighter border radius:

import { FLAT_APPEARANCE } from '@flopay/shared';
 
// {
//   theme: 'flat',
//   variables: {
//     ...DEFAULT_APPEARANCE.variables,
//     borderRadius: '4px',
//   },
// }

NIGHT_APPEARANCE

Dark background with adjusted colors:

import { NIGHT_APPEARANCE } from '@flopay/shared';
 
// {
//   theme: 'night',
//   variables: {
//     colorPrimary: '#7B7BFF',
//     colorBackground: '#1A1A2E',
//     colorText: '#E0E0E0',
//     colorDanger: '#FF6B6B',
//     borderRadius: '8px',
//     fontFamily: 'Poppins, system-ui, sans-serif',
//     fontSizeBase: '16px',
//     spacingUnit: '4px',
//   },
// }

Applying a Theme

Pass the appearance to FloPayProvider options or to loadFloPay:

import { NIGHT_APPEARANCE } from '@flopay/shared';
import { loadFloPay } from '@flopay/js';
import { FloPayProvider, CheckoutForm } from '@flopay/react';
 
const flopayPromise = loadFloPay('pk_test_...');
 
function DarkCheckout() {
  return (
    <FloPayProvider
      flopay={flopayPromise}
      options={{
        appearance: NIGHT_APPEARANCE,
        paymentMethodCreation: 'manual',
      }}
    >
      <CheckoutForm sessionId="..." billingApiUrl="..." onComplete={handleComplete} />
    </FloPayProvider>
  );
}

Custom Appearance

Create your own appearance by defining the variables you want to override:

import type { FloPayAppearance } from '@flopay/shared';
 
const customAppearance: FloPayAppearance = {
  theme: 'default',
  variables: {
    colorPrimary: '#0066FF',
    colorBackground: '#F8F9FA',
    colorText: '#333333',
    colorDanger: '#CC0000',
    borderRadius: '12px',
    fontFamily: 'Inter, system-ui, sans-serif',
    fontSizeBase: '14px',
    spacingUnit: '6px',
  },
};

Variable Reference

VariableTypeDescription
colorPrimaryCSS colorPrimary/accent color for buttons and focus states
colorBackgroundCSS colorBackground color of input fields
colorTextCSS colorText color for labels and input values
colorDangerCSS colorError message and validation state color
borderRadiusCSS lengthBorder radius for inputs and buttons
fontFamilyCSS font-familyFont stack for all text
fontSizeBaseCSS lengthBase font size
spacingUnitCSS lengthBase spacing unit for padding and margins

The appearance is passed through to the underlying Stripe Elements configuration. Stripe maps these variables to its own theming system.

On this page