mailnix / Styling forms with CSS

    Forms

    Styling forms with CSS

    The script embed renders your form as plain DOM on your own page, so your stylesheet can restyle every part of it. This page is the styling contract: the class names you can target, the design-token custom properties, and copy-paste recipes for the common jobs.

    Which modes support custom CSS

    ModeCustom CSSNotes
    Script embedFullInline DOM on your page; every .mnx-* selector below is yours to style
    Hosted pageTheme tokens onlyRendered on forms.mailnix.ch; use the designer's Theme tab
    Iframe embedTheme tokens onlyWraps the hosted page; the iframe boundary blocks outside CSS
    Headless APINot applicableYou build the whole UI; there is no mailnix DOM

    The stability contract

    Class names and custom properties are frozen within embed major v1: a selector documented here keeps working for as long as you load /embed/v1.js. New classes may be ADDED (new field types, new widgets); documented ones are never renamed or removed within the major. Breaking changes would ship as /embed/v2.js, which no page loads until you change the snippet yourself.

    Two internals are exempt and must not be styled or unhidden: the honeypot wrapper (.mnx-hp-wrap) is an anti-spam trap that must stay off-screen, and the injected style element id mnx-form-style-v1 is not a styling surface.

    Design tokens (CSS custom properties)

    All tokens live on the .mnx-form root element and cascade from there. Override them in your stylesheet for broad restyling before reaching for per-class rules:

    TokenDefaultDrives
    --mnx-primary#0ea5e9Button background, focus outline, radio/checkbox accent, links in info text, active step
    --mnx-bgtransparentRoot background behind the card
    --mnx-surface#ffffffCard and input backgrounds
    --mnx-text#111827Body text
    --mnx-muted#6b7280Help text, captions, inactive steps
    --mnx-border#d1d5dbCard, input, and divider borders
    --mnx-error#dc2626Error text, banner accent, required marker
    --mnx-radius8pxCorner rounding on card, inputs, buttons
    --mnx-fontsystem stackFont family for everything

    One precedence caveat: tokens you set in the designer's Theme tab are applied as inline styles on the root and beat your stylesheet. If you want your CSS to own a token (for example to follow your site's dark mode), leave that token unset in the designer theme.

    Selector reference

    The DOM shape is .mnx-form > .mnx-card > form, with a .mnx-banner for form-level errors, an optional .mnx-stepper, one .mnx-page per step, and a .mnx-nav button row at the end.

    SelectorWhat it wrapsSafe to change
    .mnx-formRoot container; carries the tokens and .mnx-dark in dark modeTokens, font, max-width, background
    .mnx-cardThe bordered card around the whole formBorder, background, padding, shadow, radius
    .mnx-pageOne step's fields (flex row, wraps)Gap, direction
    .mnx-fieldOne field: label + control + help + errorMargin, flex-basis
    .mnx-labelField labelTypography, color
    .mnx-reqThe required marker inside the labelColor, content spacing
    .mnx-helpHelp text under the labelTypography, color
    .mnx-input, .mnx-select, .mnx-textareaThe controlsBorder, background, padding, typography, :focus outline
    .mnx-choiceOne radio/checkbox row (label wrapping the input)Spacing, typography
    .mnx-ratingRating field wrapper (contains .mnx-choice items)Layout, gap
    .mnx-computedRead-only computed valueTypography
    .mnx-headingheading structure fieldTypography, margins
    .mnx-infoinfo_text block (sanitized markdown)Typography, link color
    .mnx-imageimage structure fieldSize, radius, borders
    .mnx-captionImage captionTypography
    .mnx-dividerdivider structure field (an <hr>)Border, margins
    .mnx-error-msgPer-field validation messageTypography, color
    .mnx-bannerForm-level error banner above the fieldsColors, border, padding
    .mnx-btnSubmit and Next buttonsEverything a button allows
    .mnx-btn-ghostBack button (also carries .mnx-btn)Same
    .mnx-navThe Back/Next/Submit rowLayout, alignment
    .mnx-stepperMulti-step progress headerLayout, gap
    .mnx-stepOne step entry (with .mnx-step-active / .mnx-step-done states)Typography, colors
    .mnx-step-dotThe numbered circleSize, colors
    .mnx-step-lineConnector between stepsColor, thickness
    .mnx-grid-rowA 12-column layout row (grid)Gap; spans come from .mnx-span-1 through .mnx-span-12
    .mnx-w-half, .mnx-w-third, .mnx-w-two-thirdsWidth-token fields outside grid rowsFlex-basis
    .mnx-repeat-itemOne entry of a repeating groupBorder, background, spacing
    .mnx-repeat-removeThe remove button on a repeat entryTypography, color
    .mnx-thanksThe post-submit thank-you screenTypography, spacing
    .mnx-captchaCAPTCHA widget wrapper (when enabled)Margins only

    Specificity: make your rules win

    The embed injects its stylesheet into <head> at render time, which is usually after your own stylesheets, so a bare .mnx-btn rule in your CSS can lose the tie. Scope your overrides under a parent for higher specificity and you never need !important:

    #contact .mnx-btn { background: #16a34a; }
    /* or */
    .mnx-form .mnx-btn { background: #16a34a; }

    Recipes

    Brand the button:

    .mnx-form { --mnx-primary: #16a34a; --mnx-radius: 999px; }
    .mnx-form .mnx-btn { font-weight: 700; letter-spacing: 0.01em; }

    Restyle inputs and focus:

    .mnx-form .mnx-input,
    .mnx-form .mnx-select,
    .mnx-form .mnx-textarea {
      border: 0;
      border-bottom: 2px solid var(--mnx-border);
      border-radius: 0;
      background: transparent;
      padding-left: 0;
    }
    .mnx-form .mnx-input:focus,
    .mnx-form .mnx-select:focus,
    .mnx-form .mnx-textarea:focus {
      outline: none;
      border-bottom-color: var(--mnx-primary);
    }

    Match your site's dark mode (works when the designer theme leaves these tokens unset; see the precedence caveat above):

    @media (prefers-color-scheme: dark) {
      .mnx-form {
        --mnx-surface: #1f2937;
        --mnx-text: #f9fafb;
        --mnx-muted: #9ca3af;
        --mnx-border: #4b5563;
      }
    }

    Full-bleed layout (drop the card so the fields sit directly on your page):

    .mnx-form .mnx-card {
      border: 0;
      background: transparent;
      padding: 0;
    }

    Custom error styling:

    .mnx-form { --mnx-error: #b91c1c; }
    .mnx-form .mnx-error-msg { font-weight: 600; }
    .mnx-form .mnx-banner {
      border-left-width: 6px;
      background: #fef2f2;
    }

    Where to go further

    Layout (columns, spans, steps) belongs in the designer, not in CSS: the grid rows and width tokens ship with the form definition so every consumption mode renders them. Colors, radius, and fonts that should apply on the HOSTED page too belong in the Theme tab, since your stylesheet never reaches forms.mailnix.ch. Your own CSS is the right tool exactly when the form must sit seamlessly inside your site's design system.