FormWork documentation

Advanced Theming

Override saved embed themes with CSS variables and understand theme precedence.

Most teams should style in the Appearance editor. Use this page when a host application needs code-level control.

Precedence

The client resolves presentation in this order:

  1. A web component theme attribute overrides the saved mode.
  2. --formwork-* variables set on the host element override saved values.
  3. Saved form-version values apply next.
  4. Built-in defaults fill anything unset.

Force the mode

<formwork-form form-id="FORM_ID" theme="dark"></formwork-form>

Accepted values are auto, light, and dark. Invalid values are normalised to auto.

Colour variables

Each colour exists for both light and dark. Replace {mode} with either word:

VariablePurpose
--formwork-{mode}-primaryButtons, focus, active accents
--formwork-{mode}-bgOuter background
--formwork-{mode}-card-bgForm/control surfaces
--formwork-{mode}-text-primaryMain text
--formwork-{mode}-text-secondarySupporting text
--formwork-{mode}-text-tertiaryMuted text
--formwork-{mode}-borderMain borders
--formwork-{mode}-border-lightSubtle dividers/borders
--formwork-{mode}-errorError text and borders
--formwork-{mode}-error-bgError surface

Layout and type variables

VariableExamplePurpose
--formwork-spacing10pxBase spacing scale
--formwork-radius8pxGeneral corner radius
--formwork-radius-full50%Repeater action radius
--formwork-font-familyInter, sans-serifBody font stack
--formwork-font-family-headingsGeorgia, serifHeading font stack
--formwork-max-width720pxForm maximum width

Example override

<style>
  #support-form {
    --formwork-light-primary: #0f766e;
    --formwork-dark-primary: #2dd4bf;
    --formwork-light-bg: #f8fafc;
    --formwork-light-card-bg: #ffffff;
    --formwork-light-text-primary: #0f172a;
    --formwork-light-border: #cbd5e1;
    --formwork-radius: 4px;
    --formwork-font-family: Inter, sans-serif;
    --formwork-max-width: 720px;
  }
</style>

<formwork-form id="support-form" form-id="FORM_ID"></formwork-form>
<script src="https://app.useformwork.com/static/client.js" type="module"></script>

Shadow and light DOM

The default render mode uses an open shadow root. Variables set on the host cross that boundary, but ordinary host selectors do not style internal elements.

Set render-mode="light" only when the form must participate in the page’s light DOM. The component still injects its own client stylesheet, and broad host-page selectors can then affect it, so test for CSS collisions.

<formwork-form form-id="FORM_ID" render-mode="light"></formwork-form>

Troubleshooting

SymptomCheck
Saved colours do not appearLook for host variables overriding them.
Auto always looks lightConfirm the device/browser dark preference and test the builder simulation.
Inner CSS selectors have no effectDefault shadow DOM isolates internals; use variables or intentional light DOM.
Custom font falls backMake sure the host loads that font, unless it is one of the Appearance editor’s Google Fonts.
Draft and live look differentAppearance is versioned; compare the draft and published version settings.