Style your form
A form embedded on your website takes your site's text colour, a plain system font, and the button colours and corners from your brand (Settings → Brand). The form's own Appearance settings in the CRM come on top. To go further, style it from your own site's CSS: every part of the form has a fixed class, and the look is built from CSS variables you can set.
Your CSS always wins over the form's defaults. The form's built-in rules have zero specificity, so a plain .cf-button { … } in your stylesheet replaces them without any special tricks.
Which setting wins
From weakest to strongest:
- The form's defaults.
- The brand and the form's Appearance settings in the CRM.
- Your site's CSS.
- Settings on the embed's
<script>tag (below).
CSS variables
Set them on .cf-root (every form) or #codefab-signup-<form id> (one form).
| Variable | What it sets | Default |
|---|---|---|
--cf-font | Font family | The visitor's system font (data-font="inherit" for your site's) |
--cf-font-size | Text and input size | 14px |
--cf-text | Text colour | Your site's text colour |
--cf-label | Labels and headings | Same as the text |
--cf-muted | Hints and help text | The text colour, a little lighter |
--cf-bg | Background behind the form | transparent |
--cf-input-bg | Input background | #fff |
--cf-input-border | Input border | #ccc |
--cf-radius | Corners of inputs and the button | From your brand |
--cf-accent | Ticked boxes, chosen scores, focus ring, the thank-you check mark | Your brand's button colour |
--cf-button-bg | Button background | Your brand's button colour |
--cf-button-text | Button text | Your brand's button text colour |
--cf-error | Error messages and required marks | #e03131 |
--cf-gap | Space between fields | 10px |
--cf-max-width | Widest the form gets | 420px |
--cf-padding | Space inside the form's edge | 0 |
Classes
| Class | Part |
|---|---|
.cf-root | The box the form sits in |
.cf-form | The form |
.cf-banner | The banner image |
.cf-heading | The headline |
.cf-text | A text block |
.cf-field | A contact field with its label (data-field holds the field's key) |
.cf-question | A survey question (data-question holds its key, data-type its type) |
.cf-label | A field's or question's label |
.cf-hint | Help text and "Choose 1–2." under a label |
.cf-input, .cf-textarea | Text inputs, lists and text areas |
.cf-choice | One option of a choice, yes/no or score |
.cf-scale | The row of scores of a rating or NPS question |
.cf-consent | The consent checkbox and its text |
.cf-button | The send button |
.cf-error | An error message |
.cf-success | The thank-you message after sending |
.cf-closed | The message of a switched-off form |
Settings on the script tag
Add these to the embed's <script> tag. Each one is optional, and a value that isn't a plain colour, size or font name is ignored.
| Attribute | What it does |
|---|---|
data-theme="dark" | Light text and dark inputs for a dark page. auto follows the visitor's device; light is the default. The CAPTCHA check follows it. |
data-accent="#0b7285" | Accent and button colour |
data-font="inherit" | Your site's font instead of the form's own. A font name also works. |
data-max-width="600px" | Widest the form gets (none for the full width) |
data-unstyled | Leaves out the form's own look completely, for a site that styles every part itself |
data-prefill-<key>="…" | Fills in a field or answers a question in advance (below) |
Filling in answers in advance
data-prefill-<key> on the script tag, or ?cf_<key>= in the page's address, puts a value in the field or question with that key. The address wins when both are set. The keys are the contact fields' keys (email, first_name) and the questions' key, as the API returns them (GET /api/v1/signup-forms/{id}).
<script src="https://crm.codefab.dev/public/signup/{id}/embed.js" asyncdata-prefill-email="anna@example.com" data-prefill-shop="Web"></script>
A value is only used when it fits: one of the options of a choice (ignoring upper and lower case), several options separated by commas for a multiple choice, a score in range, yes or no for a yes/no question, a real date for a date. Anything else, and any key the form doesn't have, is left out. Prefilled values are only suggestions: the visitor can change them before sending.
Example: match your site's colours
<style>.cf-root {--cf-font: "Inter", sans-serif;--cf-accent: #0b7285;--cf-button-bg: #0b7285;--cf-radius: 2px;--cf-max-width: 520px;}.cf-button {text-transform: uppercase;letter-spacing: 0.04em;padding: 12px 28px;}.cf-label {font-weight: 500;}</style><script src="https://crm.codefab.dev/public/signup/{id}/embed.js" async></script>
Example: a dark section of your site
<section style="background: #111827; padding: 32px"><script src="https://crm.codefab.dev/public/signup/{id}/embed.js" asyncdata-theme="dark" data-accent="#f59e0b"></script></section><style>.cf-root {--cf-input-bg: #1f2937;--cf-input-border: #374151;--cf-button-text: #111827;}</style>
On the form's own page (the /public/f/… link) the form wears your whole brand: its font, colours and button. The same variables apply there, through the form's Appearance settings in the CRM.