Skip to Content
Docs

Form container

Style the outermost wrapper of the Universal checkout form using the base key in the style object.

The base key in the style object targets the outermost wrapper of the entire checkout form. Use it to set your background color, font family, text color, and border radius at the top level.

Styles applied to base cascade into all child regions (card fields, buttons, dividers, and saved payment methods) unless a more specific key overrides them. This makes base the right place to set global defaults for the form's look.

Diagram showing the base key wrapping the entire checkout form with styles cascading to all child regions

Background and border

Set a background color and border radius on the form wrapper to match your page layout.

checkout.universal({
  container: '#pay-com-checkout',
  style: {
    base: {
      backgroundColor: '#ffffff',
      borderRadius: '16px',
      border: '1px solid #e5e7eb',
      padding: '24px',
    }
  }
})

Typography

Set a global font family and text color. All text inside the form inherits these values unless overridden by a more specific key.

checkout.universal({
  container: '#pay-com-checkout',
  style: {
    base: {
      fontFamily: "'Inter', sans-serif",
      color: '#111827',
      fontSize: '14px',
    }
  }
})

How cascading works

Values you set on base flow down to every region inside the form. For example, if you set fontFamily on base, the card fields, submit button, dividers, and APM buttons all use that font.

To override a specific region, use that region's key. The more specific key takes priority over base for the properties it defines, while inheriting everything else.

checkout.universal({
  container: '#pay-com-checkout',
  style: {
    base: {
      backgroundColor: '#f9fafb',
      color: '#111827',
      fontFamily: "'Inter', sans-serif",
      borderRadius: '16px',
    },
    // Override just the submit button's background and text color.
    // It still inherits fontFamily from base.
    submit: {
      backgroundColor: '#2563eb',
      color: '#ffffff',
    }
  }
})

All CSS property names must be in camelCase. Use borderRadius, not border-radius. Values that are not valid CSS properties are silently ignored.

Next steps

  • Card form: Style individual card input fields, labels, and submit buttons.
  • Payment methods: Style wallet buttons, the payment form container, and dividers.
  • Style object reference: Full list of every accepted key and CSS property.
Was this page helpful?