Customizing the Fairing SDK

Restyle the survey UI with CSS custom properties and class hooks, without forking the SDK.

Fairing's survey UI is styled with CSS custom properties and BEM-style class hooks, so you can match the look of your storefront without forking the SDK. This guide explains the token system, documents the class hooks, and shows worked examples you can drop into a stylesheet on your own pages.

Quickstart

The fastest restyle is a one-line change to the brand color. Every filled button, selected state, highlight and accent reads through the --fg-theme-brand-700 token, so overriding that one property cascades across the entire survey.

/* Drop into your site's stylesheet */
.fairing {
  --fg-theme-brand-700: #1f7a3a;
  --fg-theme-brand-800: #27904a;
  --fg-theme-brand-900: #34a35b;
}

How did you hear about us?

We’d love to know how you found our store.

Powered by Fairing

Override on .fairing (the SDK's root element) to keep the change scoped. Nothing else on your page is affected.

The token system

Tokens are organized in two tiers. Theme scales hold raw color, type and spacing values. Semantic tokens reference those scales and are what the components actually consume.

/* Tier 1: theme scale (raw color rung) */
--fg-theme-brand-700: oklch(0.26 0.05 274.15);

/* Tier 2: semantic token (points at a scale rung) */
--fg-bg-fill-brand-primary: var(--fg-theme-brand-700);

/* Applied in a component rule */
.fairing__action--submit {
  background-color: var(--fg-bg-fill-brand-primary);
}

Most of the time you only need to touch tier 1: override the --fg-theme-brand-* scale and every semantic token downstream updates automatically. Reach for tier 2 when you need to change one surface in isolation, for example darkening the action bar background without recoloring fills.

📘

Scope your overrides

Always set tokens on .fairing, not :root or body. The SDK's root element acts as the token boundary, which keeps your customizations from leaking into the rest of your site.

Color tokens

Colors are expressed in OKLCH so lightness ramps stay perceptually even across hue shifts. You can override with any valid CSS color: oklch(), hsl() or hex.

Base scale (neutrals)

Used for surfaces, borders and body copy.

base-25oklch(0.99 0 0)
base-50oklch(0.98 0 0)
base-100oklch(0.96 0.01 0)
base-200oklch(0.93 0.01 0)
base-300oklch(0.91 0.01 0)
base-400oklch(0.89 0.01 159.75)
base-500oklch(0.85 0.02 160.46)
base-600oklch(0.79 0.02 161.26)
base-700oklch(0.64 0.03 160.13)
base-800oklch(0.61 0.03 161.22)
base-900oklch(0.5 0.02 162.13)
base-950oklch(0.24 0.02 162.68)

Brand scale

The default brand scale is a deep indigo. --fg-theme-brand-700 is the primary fill, -800 is hover and -900 is active. -100 through -300 drive subtle hover and tertiary surfaces.

brand-25oklch(0.99 0 0)
brand-50oklch(0.98 0.01 0)
brand-100oklch(0.96 0.01 276.31)
brand-200oklch(0.93 0.02 274.15)
brand-300oklch(0.91 0.03 275.22)
brand-400oklch(0.88 0.04 274.5)
brand-500oklch(0.84 0.05 274.92)
brand-600oklch(0.77 0.06 273.89)
brand-700oklch(0.26 0.05 274.15)
brand-800oklch(0.35 0.05 273.8)
brand-900oklch(0.51 0.06 274.13)
brand-950oklch(0.27 0.05 274.33)

Semantic color tokens

These are the higher-level tokens consumed by components. Override them when you need finer control than recoloring the brand scale.

TokenDefaultUsed by
--fg-bg-fill-brand-primarybrand-700Submit button, checked checkbox
--fg-bg-fill-brand-primary-hoverbrand-800Selected NPS button
--fg-bg-fill-brand-primary-activebrand-900Active/pressed brand fills
--fg-bg-fill-brand-tertiary-hoverbrand-300NPS hover background
--fg-bg-surface-brand-tertiarybrand-100Autosuggest hovered/selected option
--fg-bg-surface-base-secondarybase-50Action bar, inputs, textarea
--fg-bg-fill-danger-primarydanger-700Inline error notice
--fg-border-base-primarybase-500Card, inputs, controls
--fg-border-brand-primary-hoverbrand-600NPS hover border
--fg-border-brand-primary-activebrand-700Focus rings, checked controls
--fg-text-base-primarybase-950Title, body copy, response labels
--fg-text-base-secondarybase-900Description, branding link
--fg-text-brand-activebrand-900Autosuggest selected option text
--fg-text-brand-hoverbrand-800NPS hover text
--fg-text-overlay-w-primarywhiteText on filled brand surfaces

Typography tokens

Font size and weight live on tokens too. Sizes use a clamp() plus container-query (cqi) formula so type scales fluidly inside the survey card. This keeps text readable in both inline embeds and full-screen modals.

TokenDefaultUsed by
--fg-font-size-xs~10–13 pxPowered-by branding
--fg-font-size-sm~13–14 pxError indicator
--fg-font-size-md16 pxBody, labels, inputs, button
--fg-font-size-lg~18–20 pxSuccess message
--fg-font-size-xl~20–25 pxQuestion title
--fg-font-weight-normal400Description, body
--fg-font-weight-strong500Title, submit, success
📘

Setting a custom font family

Font family is not yet a token. Apply it directly to the .fairing root: .fairing { font-family: "Your Brand Serif", Georgia, serif; }. All survey text inherits from the root, so one declaration covers the entire SDK.

Spacing and shape

Spacing follows the same fluid-clamp pattern as type. Sticking to the existing scale keeps internal rhythm consistent. If you need slightly larger padding, bump the whole scale rather than tweaking individual rules.

TokenDefault
--fg-space-3xs4–5 px
--fg-space-2xs8–10 px
--fg-space-xs12–15 px
--fg-space-sm16–20 px
--fg-space-md20–25 px
--fg-space-lg24–30 px
--fg-space-md-lg20–30 px (horizontal padding)
--fg-space-2xl-3xl32–45 px (success message padding)
--fg-radius-xs2–3 px (controls, inputs)
--fg-radius-sm4–5 px (submit button)
--fg-radius-md8–10 px (survey card)
--fg-shadow-mdCard drop shadow in modal mode

Class hooks

When a token isn't enough (for instance, you want a different border radius on the submit button but not the survey card), use the class hooks below. Every interactive element has a .fairing__* class you can target.

ClassElement
.fairingRoot container. Token overrides go here.
.fairing-containerOuter container (inline embeds).
.fairing-container--full-screenModal/overlay variant.
.fairing-container--is-activeApplied while the survey is visible.
.fairing__survey / .fairing-questionSurvey card.
.fairing-survey__titleQuestion prompt heading.
.fairing__question-descriptionSub-description copy.
.fairing__responsesWrapper around all response options.
.fairing__responseOne response row.
.fairing__response-labelThe clickable label text.
.fairing__radio-controlCustom radio.
.fairing__checkbox-controlCustom checkbox.
.fairing__nps-controls / .fairing__nps-controlNPS button row and individual buttons.
.fairing__nps-labels0–10 endpoint labels under NPS.
.fairing__open-ended-responseFree-text textarea.
.fairing__other-response"Other" text input next to a radio.
.fairing__date-response__inputDate picker fields.
.fairing__autosuggest__inputTypeahead search input.
.fairing__autosuggest__listTypeahead dropdown panel.
.fairing__autosuggest__optionOne row in the dropdown.
.fairing__autosuggest__highlightMatched substring inside an option.
.fairing__survey-actionsFooter bar (submit and branding).
.fairing__action--submitPrimary submit button.
.fairing__branding / .fairing__branding-link"Powered by Fairing" line.
.fairing__close-buttonDismiss button (modal mode only).
.fairing__error-noticeInline error banner.
.fairing__success-messagePost-submit thank-you state.

Data attribute hooks

The SDK also exposes a few data-* attributes for type-specific targeting:

  • [data-fairing-question-type="single_response"], "multi_response", "open_ended", "nps", "date", "autosuggest": on the form.
  • [data-fg-component="fg-nps"], [data-fg-component="fg-autosuggest"]: on the responses container.
  • [data-enquire-response="…"]: on each radio or checkbox, carrying the literal response value.

Recipes

1. Replace the full brand palette

For a polished restyle, set the whole brand ramp so hover, active and tertiary states all sit on the same hue.

.fairing {
  --fg-theme-brand-100: #f7e8e3;
  --fg-theme-brand-300: #e9c0b3;
  --fg-theme-brand-600: #b5573a;
  --fg-theme-brand-700: #7a2f1b;
  --fg-theme-brand-800: #5d2314;
  --fg-theme-brand-900: #3f180e;
}

How would you rate us?

Not likelyVery likely

2. Match a serif brand

Apply your font family on .fairing and everything inherits. You can also nudge the title weight if your headline face needs a heavier cut.

.fairing {
  font-family: "Caslon", Georgia, serif;
  --fg-font-weight-strong: 600;
}

.fairing .fairing-survey__title {
  letter-spacing: -0.01em;
}

What brought you to The Atelier today?

A quick note helps us tailor your next visit.

3. Soften (or sharpen) corners

Update the radius tokens together so all rounded elements stay consistent. Set them to 0 for a hard-edged editorial look.

.fairing {
  --fg-radius-xs: 0;
  --fg-radius-sm: 0;
  --fg-radius-md: 0;
}

.fairing .fairing__survey {
  border-color: #111;
  border-width: 2px;
}

Anything we should know?

4. Dark mode

Recolor surfaces and text together. The cleanest path is to invert the base scale so the SDK's built-in selectors keep doing the right thing.

.fairing {
  --fg-theme-base-50:  #1a1d22;  /* action bar, inputs */
  --fg-theme-base-500: #3b424d;  /* borders */
  --fg-theme-base-900: #c5cbd3;  /* secondary text */
  --fg-theme-base-950: #f3f5f7;  /* primary text */
}

.fairing .fairing__survey {
  background: #0f1115;
}

Did you find what you were looking for?

Powered by Fairing

5. Custom submit button shape

When you want one element to break from the system, such as a pill-shaped CTA, target its class hook directly. Keep the change scoped under .fairing so you don't override unrelated buttons on your page.

.fairing .fairing__action--submit {
  border-radius: 9999px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 13px;
  padding: 12px 28px;
}

Pick your shipping preference

Powered by Fairing

6. Restyle the modal backdrop

The full-screen variant adds .fairing-container--full-screen. Override its background color to tint the page dim differently, for example a darker scrim that matches your site's modal style.

.fairing.fairing-container--full-screen {
  background-color: rgba(15, 17, 21, 0.72);
  backdrop-filter: blur(4px);
}

.fairing .fairing__survey {
  border-radius: 14px;
}

One quick question

Help us learn what brought you here today.

Powered by Fairing

Anatomy of a rendered survey

For reference, this is the markup the SDK injects for a single-response question. The same skeleton applies to every question type, with the responses container adapting to the type.

<div class="fairing fairing-container fairing-container--is-active">
  <form class="fairing__survey" data-fairing-question-type="single_response">
    <h2 class="fairing-survey__title">How did you hear about us?</h2>
    <p class="fairing__question-description">We'd love to know.</p>

    <div class="fairing__responses">
      <div class="fairing__response">
        <input type="radio"
               class="fairing__radio-control"
               data-enquire-response="Web Search">
        <label class="fairing__response-label">Web Search</label>
      </div>
      <!-- more .fairing__response rows -->
    </div>

    <div class="fairing__survey-actions">
      <button class="fairing__action--submit">Submit</button>
      <p class="fairing__branding">
        Powered by <a class="fairing__branding-link">Fairing</a>
      </p>
    </div>
  </form>
</div>

Caveats and tips

Stick to the token API where you can

Tokens are stable: they're part of the SDK's public contract. Internal selectors (anything not listed in the class hooks table above) can change between releases, so prefer a token override before reaching for a selector override.

Don't fight the container queries

Type and spacing scale with the survey container, not the viewport. If you hard-code font sizes you'll lose the fluid behavior. Use the --fg-font-size-* tokens or keep your overrides relative (em / %).

Specificity

The SDK's own rules use a single class of specificity. Any compound selector starting with .fairing (for example .fairing .fairing__action--submit) wins cleanly without !important.

Load order

fairing.js inserts its <link rel="stylesheet"> before the first existing stylesheet on the page, and appends to <head> only when no stylesheets are present yet. That means your site's own styles cascade after the SDK's, so an override of equal specificity wins without !important or specificity hacks. You can put your overrides in any stylesheet your page already loads.

📘

Questions?

Email [email protected] with a screenshot of the look you're going for and we'll send back a tested override snippet.

Token names and class hooks reflect SDK v1 as currently shipped.


Did this page help you?