Skip to main content

Appearance API (Beta)

The Appearance API is the stable beta v1 surface for styling every piece of UI rendered by the Revup SDK: the parent-page container, payment-method buttons, the card form iframe, and overlay states. You pass a single appearance object to revup.init({ appearance }).

The current contract is composed from a theme preset, optional variables overrides, and optional rules for allowlisted abstract targets. Public token names, emitted CSS variable names, and rule-target keys are part of the v1 API and should be treated as stable.

Beta

This is the beta version and is subject to changes and corrections. Although it has been subjected to strict testing and rigorous reviews, there may be certain minimal inconsistencies in meanings and hierarchies. Any feedback will be of great help.

Quick start

const revup = new Revup({ apiKey: 'pk_live_...', orderId: 'order_123' });

await revup.init({
containerId: 'checkout',
appearance: {
theme: 'default',
variables: {
backgroundColor: '#000000',
submitButtonBackgroundColor: '#7B8CDE',
inputBorderColorFocus: '#7B8CDE',
},
rules: {
'.InputWrapper--focused': {
'border-width': '2px',
},
},
},
});

How it works

The Appearance API has three inputs:

appearance
├── theme — preset base ('default' | 'dark' | 'flat' | 'minimal')
├── variables — domain-grouped design tokens
└── rules — per-element CSS overrides for allowlisted abstract targets

Every resolved variable is emitted on the host page as --revup-<kebab-case-token>. Parent-page rule targets are injected into the merchant page, while iframe rule targets are injected into the card form iframe. The host and iframe surfaces share one resolved appearance object, but each render context has its own target map and managed style tag.

Runtime behavior

  1. The SDK resolves theme. Unknown theme ids fall back to default.
  2. variables are merged on top of the theme preset.
  3. Numeric tokens are clamped to their supported ranges. Padding and border-radius shorthands are expanded before clamping.
  4. String-valued variables are sanitized. Invalid values are dropped and the SDK logs a console warning.
  5. rules are sanitized. Unknown targets, disallowed properties, and invalid values are dropped silently.
  6. The SDK emits host CSS custom properties, applies parent-page rules through a managed <style> tag, and forwards the resolved appearance into the iframe projection path.
  7. Re-initializing the SDK clears previously emitted host CSS variables and replaces the managed appearance rule tags, so the latest configuration fully wins.

Theme presets

The default preset is the only preset that assigns a value to every token. The other presets inherit from default and override only the entries that differ.

For the exact current preset values, inspect APPEARANCE_THEME_PRESETS in the SDK source. APPEARANCE_THEME_PRESETS.default is the source of inherited values for the other three presets.

PRESETDESCRIPTION
defaultLight baseline preset with violet primary (#8E54E9), white surfaces, 8 px radius, and Plus Jakarta Sans typography. This is the inheritance source for all other presets.
darkDark surfaces, light text, dark input backgrounds, and a lavender submit-button accent.
flatMinimal borders and flatter surfaces. Focus styling prefers outline over box-shadow.
minimalReduced chrome, sharp corners, transparent borders, lighter shadows, and animations disabled.

Variables

Variables are domain-grouped design tokens. The current public surface is organized by functional area.

Foundation (Global)

fontFamily, fontWeightRegular, fontWeightBold, disableAnimations, transitionDuration

Parent Container Layout

backgroundColor, textColor, width, height, maxWidth, padding, borderRadius, justifyContent, alignItems

Form Container (Parent Wrapper)

formBackgroundColor, formPadding, formBorderRadius

Payment Methods Section — Container Layout

paymentMethodsContainerPadding, primaryGridGap

Payment Methods Section — Payment Method Rows & Buttons

paymentMethodHeight, paymentMethodBorderWidth, paymentMethodBorderRadius, paymentMethodBackgroundColor, paymentMethodBorderColor, paymentMethodBoxShadow

Card Button

cardButtonBackgroundColor, cardButtonTextColor, cardButtonBorderColor, cardButtonBorderWidth, cardButtonBorderRadius, cardButtonFontSize, cardButtonFontWeight, cardButtonPadding

cardButtonBackgroundColorHover, cardButtonBorderColorHover, cardButtonTextColorHover

cardButtonBackgroundColorOpen, cardButtonTextColorOpen, cardButtonBorderColorOpen

Card Badge

cardBadgeBackgroundColor, cardBadgeTextColor, cardBadgeFontSize, cardBadgeFontWeight, cardBadgeLetterSpacing, cardBadgeBorderRadius, cardBadgePadding

cardBadgeBackgroundColorOpen, cardBadgeTextColorOpen

Secondary Divider (Other Methods Section)

secondaryGridGap, secondaryDividerColor, secondaryDividerThickness

secondaryDividerLabelTextColor, secondaryDividerLabelBackgroundColor, secondaryDividerLabelFontSize, secondaryDividerLabelPadding, secondaryDividerLabelFontWeight

Other Methods Panel & Toggle

otherGridGap, otherToggleTextColor, otherToggleTextColorHover, otherToggleFontSize, otherToggleFontWeight

Form Fields (Iframe) — Field Container

fieldMinHeight, expiryCvcRowGap

Form Fields (Iframe) — Label

labelTextColor, labelFontSize, labelFontWeight, labelTextColorFocus, labelTextColorInvalid

Form Fields (Iframe) — Input

inputHeight, inputFontSize, inputPadding

inputBorderColor, inputBorderWidth, inputBorderRadius

inputBackgroundColor, inputTextColor, inputBoxShadow

inputPlaceholderColor

inputBackgroundColorHover, inputBorderColorHover

inputBackgroundColorFocus, inputBorderColorFocus, inputBoxShadowFocus, inputOutlineFocus

inputBorderColorInvalid, inputBackgroundColorInvalid

inputBackgroundColorDisabled, inputTextColorDisabled

Form Fields (Iframe) — Input Adornment

inputAdornmentColor

Form Fields (Iframe) — Error Text

errorTextColor, errorFontSize, errorFontWeight

Form Controls — Submit Button

submitButtonHeight, submitButtonBorderRadius

submitButtonBackgroundColor, submitButtonTextColor, submitButtonFontSize, submitButtonFontWeight

submitButtonBackgroundColorHover, submitButtonTextColorHover

submitButtonBackgroundColorActive

submitButtonBackgroundColorDisabled, submitButtonTextColorDisabled, submitButtonOpacityDisabled

Visual Effects — Skeleton

skeletonBackgroundColor, skeletonShimmerColor, skeletonAnimationDuration

Visual Effects — Overlay

overlayLoadingBackgroundColor, overlayDisabledBackgroundColor

Important runtime details

Fallback behavior

  • secondaryDividerLabelBackgroundColor falls back to backgroundColor when omitted.
  • labelTextColorFocus falls back to inputBorderColorFocus inside the form projection when not set explicitly.
  • inputBackgroundColorHover and inputBackgroundColorFocus fall back to inputBackgroundColor when omitted.

Scope & projection

  • textColor controls host-container text, while inputTextColor controls input text inside the iframe.
  • inputAdornmentColor is the dedicated color token for icons and adornments inside inputs.
  • formBackgroundColor, formPadding, and formBorderRadius style the parent wrapper around the iframe. The iframe still receives its own appearance projection from the resolved variables.

Rule targets

rules accepts only allowlisted abstract targets. The SDK maps these keys to concrete selectors internally; raw CSS selectors are not accepted.

There are 53 allowlisted abstract targets in total: 25 for the iframe and 28 for the parent page.

Iframe targets

TARGETMAPS TO
.FieldField row container
.Field--focusedField row while any descendant is focused
.Field--invalidField row in invalid state
.LabelField label
.Label--focusedLabel while focused
.Label--invalidLabel in invalid state
.InputWrapperVisual input frame
.InputWrapper--hoverHover state of the input frame, excluding focus and invalid
.InputWrapper--focusedFocus state of the input frame, excluding invalid
.InputWrapper--invalidInvalid input frame
.InputWrapper--disabledDisabled input frame
.InputNative input element
.Input::placeholderInput placeholder text
.InputAdornmentAdornment or icon inside the input wrapper
.ErrorField error text
.SubmitButtonPay button inside the form
.SubmitButton--hoverHover state of the pay button
.SubmitButton--activeActive state of the pay button
.SubmitButton--disabledDisabled state of the pay button
.FormContainerOuter wrapper inside the iframe
.SelectNative select element
.Select--hoverHover state of the select, excluding focus and invalid
.Select--focusedFocus state of the select, excluding invalid
.Select--invalidInvalid select element
.Select--disabledDisabled select element

Parent-page targets

TARGETMAPS TO
.RevupContainerOutermost SDK container on the merchant page
.PaymentMethodsContainerStacked payment methods container
.PaymentMethod--primaryPrimary payment methods only (non-card, non-secondary, non-other)
.PaymentMethod--cardCard payment method row
.PaymentMethod--secondarySecondary payment methods (Apple Pay, Google Pay, etc.)
.PaymentMethod--otherOther/additional payment methods
.FormContainerSlotParent wrapper around the form iframe
.PaymentMethodEach rendered payment method row
.PaymentMethodSkeletonPayment method skeleton content
.CardButtonCard accordion button
.CardButton--hoverCard button hover state
.CardButton--openCard button while the form is expanded
.CardBrandSlotCard brand/logo slot
.CardBrandIconCard brand/logo icon
.CardBadgeBadge on the card button
.CardBadge--openBadge while the form is expanded
.SecondarySectionSecondary payment-method section wrapper
.SecondaryDividerDivider line above the secondary grid
.SecondaryDividerLabelDivider label
.SecondaryGridCompact secondary APM grid
.OtherSectionOther/additional payment methods section wrapper
.OtherToggleToggle for additional payment methods
.OtherToggle--hoverHover state of the additional-methods toggle
.OtherPanelExpandable panel of additional payment methods
.OtherPanel--openExpanded state of the additional-methods panel
.LoaderSpinnerLoading spinner element
.LoaderOverlayLoading overlay
.DisabledOverlayDisabled overlay

Sanitization policy

Rules are default-deny. A declaration is kept only when:

  • The target is allowlisted
  • The property name matches /^-?[a-zA-Z][a-zA-Z0-9-]*$/
  • The property is in the SDK allowlist
  • The value passes sanitization

Allowed properties by category

CATEGORYALLOWED PROPERTIES
Color and backgroundcolor, background-color, background
Border and cornersborder, border-color, border-width, border-style, border-radius, per-side border color and width, per-corner border radius
Effectsbox-shadow, outline, outline-color, outline-width, outline-style, opacity, backdrop-filter, filter, text-shadow
Typographyfont-family, font-size, font-weight, font-style, line-height, letter-spacing, text-align, text-decoration, text-decoration-color, text-decoration-style, text-decoration-thickness, text-transform, text-underline-offset, text-overflow, white-space, word-break, word-wrap, vertical-align
Spacing and sizingpadding, margin, width, height, min-width, min-height, max-width, max-height, aspect-ratio, box-sizing
Layoutdisplay, align-items, justify-content, gap, flex, flex-direction, flex-wrap, grid-template-columns, grid-template-rows, grid-gap, column-gap, row-gap, position, top, right, bottom, left, z-index, overflow, overflow-x, overflow-y
Interaction and motionappearance, -webkit-appearance, pointer-events, user-select, cursor, transform, transform-origin, transition, transition-duration, transition-timing-function, transition-property, transition-delay, animation, animation-duration, animation-timing-function, animation-delay, animation-iteration-count, animation-name

Values are rejected when they are empty, longer than 500 characters, contain control characters, contain !important, contain HTML tags, or normalize to dangerous functions and schemes such as url(), image(), image-set(), -webkit-image-set(), cross-fade(), -webkit-cross-fade(), element(), paint(), src(), attr(), expression(), behavior(), -moz-binding, javascript:, vbscript:, data:, @import, @charset, or @namespace.

CSS escapes and comments are normalized before blocklist checks. After declaration-breakout characters are stripped, the blocklist is applied again. Invalid variables are dropped with a console warning; invalid rules are dropped silently. Per target, the first 100 accepted declarations are kept.

Numeric clamping

Numeric tokens are clamped, not rejected. Dimensional tokens are documented as pixel strings. Padding and border-radius shorthands are expanded to explicit values before each side or corner is clamped.

TOKEN GROUPBOUNDSAPPLIES TO
Payment-method row height44–55 pxpaymentMethodHeight
Payment method button styling0–10 px (border widths), 0–60 px (border radius)paymentMethodBorderWidth, paymentMethodBorderRadius
Border radius0–60 pxborderRadius, formBorderRadius, cardButtonBorderRadius, cardBadgeBorderRadius, inputBorderRadius, submitButtonBorderRadius
Control heights30–60 pxinputHeight, submitButtonHeight
Font sizes8–32 pxcardButtonFontSize, cardBadgeFontSize, inputFontSize, submitButtonFontSize, labelFontSize, errorFontSize, secondaryDividerLabelFontSize, otherToggleFontSize
Font weights1–1000fontWeightRegular, fontWeightBold, cardButtonFontWeight, cardBadgeFontWeight, submitButtonFontWeight, labelFontWeight, errorFontWeight, otherToggleFontWeight, secondaryDividerLabelFontWeight
Gaps0–40 pxprimaryGridGap, secondaryGridGap, otherGridGap, expiryCvcRowGap
Padding shorthands0–40 px per sidecardButtonPadding, cardBadgePadding, inputPadding, secondaryDividerLabelPadding
Field minimum height40–200 pxfieldMinHeight
Border widths and divider thickness0–10 pxcardButtonBorderWidth, inputBorderWidth, secondaryDividerThickness
Disabled submit opacity0–1submitButtonOpacityDisabled

Public exports

EXPORTKINDPURPOSE
AppearancetypeTop-level config object with theme, variables, and rules
AppearanceThemetypeTheme preset id: default, dark, flat, minimal
AppearanceVariablestypeDomain-grouped appearance token bag
AppearanceRuleTargettypeUnion of the allowlisted abstract rule targets
AppearanceRulestypePartial<Record<AppearanceRuleTarget, Record<string, string>>>
APPEARANCE_RULE_TARGETSruntime setUse to validate rule keys at runtime
APPEARANCE_THEME_PRESETSruntime recordBuilt-in preset values
MIN_BUTTON_HEIGHTruntime numberLower bound for paymentMethodHeight
MAX_BUTTON_HEIGHTruntime numberUpper bound for paymentMethodHeight
MIN_BORDER_RADIUSruntime numberLower bound for border-radius tokens
MAX_BORDER_RADIUSruntime numberUpper bound for border-radius tokens

Precedence

  1. rules win within their render context.
  2. variables override the theme preset and are emitted as host CSS custom properties.
  3. Theme preset provides the base token values.
  4. Built-in component defaults remain as fallbacks for anything not set by the preset or variables.