Docs navigation

Theming

The appearance prop controls visual customization. Use colorScheme to select light or dark, and variables to override individual CSS tokens.

Color scheme

<CancelFlow
  appearance={{ colorScheme: 'auto' }}
  steps={steps}
  handleCancel={handleCancel}
/>

colorScheme accepts 'light', 'dark', or 'auto'. 'auto' follows the OS preference via prefers-color-scheme and updates live when it changes. Defaults to 'light'.

CSS variables

Override design tokens through appearance.variables. Values cascade on top of the active scheme, so setting colorPrimary once works in both light and dark.

<CancelFlow
  appearance={{
    variables: {
      colorPrimary: '#7c3aed',
      colorPrimaryHover: '#6d28d9',
      borderRadius: '12px',
      fontFamily: 'Inter, system-ui, sans-serif',
    },
  }}
  steps={steps}
  handleCancel={handleCancel}
/>

The complete list, grouped by what they affect:

Surfaces

VariableWhat it controls
colorBackgroundPage background behind the modal.
colorSurfaceModal surface and card backgrounds.
colorSurfaceMutedSecondary surfaces (info banners, soft callouts).

Borders

VariableWhat it controls
colorBorderDefault borders, dividers, separator lines.
colorBorderStrongEmphasized borders (selected reasons, focus rings).

Text

VariableWhat it controls
colorTextDefault body text.
colorTextSecondaryDescription text, subheadings, secondary copy.
colorTextMutedTertiary text (helper text, captions).

Primary (brand accent)

VariableWhat it controls
colorPrimaryButtons, selected reasons, accents.
colorPrimaryHoverHover state for primary buttons.
colorPrimarySoftTinted backgrounds and highlights (selected reason fills, info banner backgrounds).

Semantic

VariableWhat it controls
colorSuccessSuccess outcome state.
colorSuccessSoftTinted background for success surfaces.
colorDangerCancel button, destructive states.
colorDangerHoverHover state for danger buttons.
colorDangerSoftTinted background for error surfaces.

Typography

VariableWhat it controls
fontFamilyBody text.
fontFamilyMonoMonospaced text (currency codes, ID labels).
fontFamilyDisplayHeadings and step titles. Defaults to fontFamily.
fontSizeBase font size.
fontWeightDisplayWeight applied to step titles. Default '600'.
letterSpacingDisplayLetter spacing on step titles. Default '-0.015em'.

Geometry

VariableWhat it controls
borderRadiusDefault radius on buttons, cards, inputs.
radiusSmTighter radius for chips and small controls.
radiusMdMedium radius for cards and inputs.
radiusLgLarger radius for prominent surfaces.
radiusXlModal surface radius.

Elevation

VariableWhat it controls
shadowModalDrop shadow on the modal surface.
shadowCardDrop shadow on inner cards (plan rows, info callouts).

Overlay

VariableWhat it controls
overlayColorColor of the modal backdrop. Defaults to a neutral translucent ink. Accepts any CSS color, including color-mix expressions to derive from the primary.

Variables forward to the DOM as --ck-* custom properties on .ck-cancel-flow. To set them from CSS instead of the appearance prop, target that selector:

.ck-cancel-flow {
  --ck-color-primary: #7c3aed;
  --ck-border-radius: 12px;
}

Dark mode

colorPrimary set once applies to both schemes. If your brand color has poor contrast against the SDK's dark-mode surface, swap it per scheme by reading prefers-color-scheme from your app:

function CancelButton() {
  // Your app's prefers-color-scheme hook.
  const isDark = useMediaQuery('(prefers-color-scheme: dark)')
 
  return (
    <CancelFlow
      appearance={{
        colorScheme: 'auto',
        variables: {
          colorPrimary: isDark ? '#a5b4fc' : '#6366f1',
        },
      }}
      steps={steps}
      handleCancel={handleCancel}
    />
  )
}

Next steps