styles attribute. Pass a JSON string of design tokens to customize colors, typography, border radius, and more — no widget redeployment needed.
Quick Start
Set a few brand tokens to theme any widget:styles attribute follows the same pattern as custom-labels — a JSON string on the HTML element.
How It Works
The widget parses the JSON, resolves tokens against built-in defaults, and applies them as CSS custom properties (--gizmo-*) at runtime. Tokens propagate through the widget’s Shadow DOM and are securely bridged into PCI-compliant iframes via URL parameters at creation time.
Interaction with theme
The theme attribute ("default" or "night-shift") sets a base preset. The styles attribute overrides individual tokens on top of it. If both are set, styles values take precedence per-token.
Token Reference
Tokens are organized into two tiers. Tier 1 (semantic tokens) are the primary styling API — setting 5–6 of these gives you a fully branded widget. Tier 2 (component overrides) provide fine-grained control over individual elements, defaulting to their Tier 1 counterparts when not set.Tier 1 — Semantic Tokens
| Token | Type | Description |
|---|---|---|
fontFamily | string | Font family for all text |
primaryColor | color | Submit button, focus rings, spinner, toggle accent |
primaryColorHover | color | Submit button hover state |
textColor | color | Labels, titles, body text |
textColorSecondary | color | Placeholders, muted text |
backgroundColor | color | Widget container background |
inputBackground | color | Input field background |
inputBorderColor | color | Input field border |
inputBorderRadius | size | Input field corner radius |
borderRadius | size | Buttons, messages, containers |
errorColor | color | Error borders and error text |
successColor | color | Success borders and success text |
Tier 2 — Component Overrides
These are optional. When not set, they inherit from Tier 1 tokens.| Token | Defaults to | Targets |
|---|---|---|
buttonBackground | primaryColor | Submit button background |
buttonTextColor | #ffffff | Submit button text |
buttonBorderRadius | borderRadius | Submit button corners |
clearButtonBackground | #ffffff | Clear/cancel button background |
clearButtonTextColor | textColor | Clear/cancel button text |
clearButtonBorderColor | inputBorderColor | Clear/cancel button border |
inputTextColor | textColor | Text typed into inputs |
inputFocusBorderColor | primaryColor | Input focus ring |
inputFontSize | 15px | Input text size |
labelColor | textColor | Field labels |
labelFontSize | 14px | Field label size |
titleColor | textColor | Widget title |
titleFontSize | 18px | Widget title size |
errorBackground | computed | Error message background |
successBackground | computed | Success message background |
Reveal Card Tokens
These apply only to the Reveal Card Widget.| Token | Targets |
|---|---|
cardBackground | Card face background (supports CSS gradient strings) |
cardTextColor | Card overlay text (PAN, name, expiry, CVV) |
cardBorderRadius | Card corner radius |
Examples
Brand Colors Only
The simplest approach — set your primary color and font:Full Customization
Override both semantic tokens and component-level tokens:Reveal Card with Custom Card Face
Dark Theme with Overrides
Start from the built-innight-shift preset, then override individual tokens:
Built-in Theme Presets
default
Light background with blue accents. This is used when theme is not set or set to "default".
night-shift
Dark background with purple accents. Apply with theme="night-shift":
Notes
- Unknown token keys are ignored. If you pass a key that doesn’t match a known token, it’s silently dropped.
- Invalid JSON falls back to defaults. A malformed
stylesstring logs a console warning and applies no overrides. - Token values are CSS values. Colors accept any CSS color format (
#hex,rgb(),hsl(), named colors). Sizes acceptpx,rem,em, etc.cardBackgroundsupports gradient strings. - Tokens apply at widget initialization. To change tokens after mount, update the
stylesattribute and the widget will re-apply.

