Customize the look of Elements fields using the style config and global appearance options.
Elements fields render inside iframes, so you can’t target them with your page’s CSS. Instead, you pass a style configuration object that the SDK applies inside each iframe.
type ElementStyleConfig = { base?: ElementStyle; // default state focus?: ElementStyle; // when the field has focus invalid?: ElementStyle; // value is present but invalid (on blur) complete?: ElementStyle; // value is complete and valid (on blur) placeholder?: ElementStyle; // styles the placeholder text};
Each key maps to an ElementStyle object where the keys are camelCase CSS properties.
Global default — pass appearance when calling OzVault.create(). It accepts an Appearance object with an optional theme preset and/or variables overrides. All elements inherit this; per-element style merges on top.
The theme preset provides a complete set of defaults. Available themes:
Theme
Description
'default'
Dark text on transparent background; neutral placeholder; indigo caret
'night'
Light text on transparent background; muted placeholder; indigo caret (dark-mode optimized)
'flat'
Dark text; no border radius; bottom-border-only underline style that changes color on focus/invalid/complete
You can combine theme + variables — the theme applies first, then variables override on top.
Omitting theme is not the same as no theme. Passing appearance: {} or appearance: { variables: { ... } } without a theme key applies the 'default' preset as a base. To render elements with no preset styling at all, omit the appearance prop entirely and use per-element style overrides.
appearance value
Result
(omitted entirely)
No preset styles — element uses its minimal built-in defaults
{}
Equivalent to { theme: 'default' } — full default theme applied
Properties like position, display, and width that could affect iframe layout are not supported. Use height / minHeight to control the field’s vertical size.
CSS custom properties (var(--token)) are not accepted in style values. The style sanitizer blocks all CSS function syntax, including var(), to prevent CSS injection through the iframe boundary. Pass literal values only:
- color: 'var(--brand-color)'+ color: '#0057FF'
When a value is blocked, the SDK strips it silently — no error is thrown and no console warning is emitted. The browser falls back to the element’s default (unstyled) appearance for that property. If your design tokens resolve to CSS variables, resolve them to their literal values before passing them in.
Call element.update({ style: { ... } }) to restyle a field without re-mounting it:
// Change only the base colorcardNumber.update({ style: { base: { color: '#333' } } });// Remove a previously set style — pass an empty bucket to clear itcardNumber.update({ style: { base: {} } });
Style update semantics:
Properties you include are merged into the current style — they replace their previous values.
Properties previously set but absent from the new style object retain their current values (no keys are cleared by omission).
To reset a specific property, pass it explicitly with an empty string: { base: { color: '' } }.
To fully reset all styles, destroy and recreate the element.
Global vault appearance theme styles are always preserved underneath.
In React, use the style prop on individual field components — it is applied on every render.