Every color, size, radius, shadow, and timing in the built-in UI is a CSS custom property named
--mlf-*. Themes and recipes set them; you can override any of them.
tokens: { "--mlf-radius-md" : "6px" },
submit: { tokens: { "--mlf-submit-radius" : "999px" } },
report: { tokens: { "--mlf-report-border" : "1px solid var(--mlf-color-border-strong)" } },
Global tokens (overrides.tokens) are the shared palette and scale: colors, radii, spacing,
shadows, fonts, and motion. Prefer them for brand color and spacing.
Component tokens (overrides.components.<key>.tokens) style one family of controls and
usually default to a global token. The keys are shell, hero, field, report, input,
submit, error, toggle, status, and chart.
Resolution order, last wins: built-in defaults, the theme’s shared tokens, the theme’s scheme
tokens (light or dark), the recipe’s tokens and component tokens, and finally overrides. A theme
without dark tokens uses its light tokens in dark mode and reports theme-fallback as the mode
source.
When your application already owns its tokens, point MLForm’s tokens at them in CSS:
#forecast-form mlf-form {
--mlf-color-accent : var ( --brand-action );
--mlf-color-text : var ( --app-text );
For forms embedded in an existing dashboard, mode: "inherit" follows the host’s light or dark
scheme (Modes ), and the minimal recipe avoids duplicating
card chrome.
mlform/design works on any element, for example a host rendered with
createFormView or createPrimitiveAdapter :
import { attachDesignSystem, resolveDesignSystem, writeDesignSystemTokenDeclarations } from "mlform/design" ;
// Live: watches the system scheme and updates the element.
const design = attachDesignSystem (host, { config: { theme: "eshkra" , mode: "auto" } });
design. update ({ mode: "dark" });
design. disconnect (); // when the host goes away
// One-off: resolve once and write the declarations yourself.
const resolved = resolveDesignSystem ({ theme: "eshkra" , recipe: "minimal" });
writeDesignSystemTokenDeclarations (host.style, resolved);
Prefer writeDesignSystemTokenDeclarations when you have an element. createDesignSystemStylesheet(resolved, selector)
produces CSS text for a stylesheet; use it only with trusted configuration.
attachDesignSystem and mountForm copy the registry they receive when they attach. Registering a
theme in the original registry later does not affect mounted forms; register before mounting, or
register on attached.registry and refresh with update({}).
These are the defaults, read from the library. Themes and recipes replace many of them.
Global tokens Token Default --mlf-font-family-body"Aptos", "Segoe UI Variable Text", "Segoe UI", ui-sans-serif, system-ui, sans-serif--mlf-font-family-heading"Aptos Display", "Segoe UI Variable Display", "Segoe UI", ui-sans-serif, system-ui, sans-serif--mlf-font-family-uiui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif--mlf-font-family-monoui-monospace, "SFMono-Regular", "SF Mono", Consolas, "Liberation Mono", monospace--mlf-font-size-xs0.72rem--mlf-font-size-sm0.84rem--mlf-font-size-md1rem--mlf-font-size-lg1.125rem--mlf-font-size-xl1.55rem--mlf-font-size-2xl2.15rem--mlf-line-height-tight1.12--mlf-line-height-normal1.5--mlf-space-10.25rem--mlf-space-20.5rem--mlf-space-30.75rem--mlf-space-41rem--mlf-space-51.25rem--mlf-space-61.5rem--mlf-space-72rem--mlf-space-83rem--mlf-radius-sm6px--mlf-radius-md8px--mlf-radius-lg10px--mlf-radius-xl14px--mlf-radius-pill999px--mlf-border-width1px--mlf-ring-width4px--mlf-shadow-sm0 1px 2px rgba(23, 35, 48, 0.04)--mlf-shadow-md0 8px 24px rgba(23, 35, 48, 0.06)--mlf-shadow-lg0 18px 40px rgba(23, 35, 48, 0.09)--mlf-motion-fast140ms ease--mlf-motion-base180ms ease--mlf-motion-slow260ms ease--mlf-transition-duration200ms--mlf-transition-easingease-in-out--mlf-layout-gap1rem--mlf-section-gap1rem--mlf-pane-gap1rem--mlf-shell-gap1.2rem--mlf-control-height3rem--mlf-control-padding-inline0.92rem--mlf-control-padding-block0.78rem--mlf-pane-min-width20rem--mlf-color-bg#f4f6f8--mlf-color-surface#ffffff--mlf-color-surface-muted#f0f3f6--mlf-color-surface-elevated#ffffff--mlf-color-text#172330--mlf-color-text-muted#526170--mlf-color-text-inverse#ffffff--mlf-color-border#d9e1e7--mlf-color-border-strong#b9c5cf--mlf-color-accent#2456c7--mlf-color-accent-hover#1b46a8--mlf-color-accent-softrgba(36, 86, 199, 0.09)--mlf-color-success#16704f--mlf-color-warning#9a640e--mlf-color-danger#b93636--mlf-color-danger-softrgba(185, 54, 54, 0.08)--mlf-color-focus-ringrgba(36, 86, 199, 0.18)--mlf-color-overlayrgba(255, 255, 255, 0.88)--mlf-color-hover-surface#e8edf2--mlf-color-chart-trackrgba(23, 35, 48, 0.11)
field component tokens Token Default --mlf-field-bgvar(--mlf-color-surface)--mlf-field-bordervar(--mlf-color-border)--mlf-field-border-invalidvar(--mlf-color-danger)--mlf-field-shadownone--mlf-field-radiusvar(--mlf-radius-lg)--mlf-field-label-colorvar(--mlf-color-text)--mlf-field-description-colorvar(--mlf-color-text-muted)--mlf-field-meta-bgvar(--mlf-color-accent-soft)--mlf-field-meta-colorvar(--mlf-color-text-muted)--mlf-field-error-bgvar(--mlf-color-danger-soft)--mlf-field-error-colorvar(--mlf-color-danger)
input component tokens Token Default --mlf-input-bgvar(--mlf-color-surface-elevated)--mlf-input-bg-disabledcolor-mix(in srgb, var(--mlf-color-surface) 92%, var(--mlf-color-text) 8%)--mlf-input-bordervar(--mlf-color-border)--mlf-input-border-focusvar(--mlf-color-accent)--mlf-input-textvar(--mlf-color-text)--mlf-input-placeholdervar(--mlf-color-text-muted)--mlf-input-radiusvar(--mlf-radius-md)--mlf-input-shadow-focus0 0 0 var(--mlf-ring-width) var(--mlf-color-focus-ring)
submit component tokens Token Default --mlf-submit-bgvar(--mlf-color-accent)--mlf-submit-bg-hovervar(--mlf-color-accent-hover)--mlf-submit-colorvar(--mlf-color-text-inverse)--mlf-submit-shadownone--mlf-submit-shadow-hovernone--mlf-submit-radiusvar(--mlf-radius-md)--mlf-submit-focus-ring0 0 0 var(--mlf-ring-width) color-mix(in srgb, var(--mlf-color-accent) 18%, transparent)
report component tokens Token Default --mlf-report-bgvar(--mlf-color-surface)--mlf-report-bordervar(--mlf-color-border)--mlf-report-shadownone--mlf-report-radiusvar(--mlf-radius-lg)--mlf-report-label-colorvar(--mlf-color-text)--mlf-report-description-colorvar(--mlf-color-text-muted)--mlf-report-meta-bgvar(--mlf-color-accent-soft)--mlf-report-meta-colorvar(--mlf-color-text-muted)--mlf-report-empty-bgcolor-mix(in srgb, var(--mlf-color-accent) 6%, transparent)--mlf-report-empty-colorvar(--mlf-color-text-muted)--mlf-report-hero-bglinear-gradient(135deg, color-mix(in srgb, var(--mlf-color-accent) 12%, transparent), color-mix(in srgb, var(--mlf-color-accent) 6%, transparent))--mlf-report-error-bgvar(--mlf-color-danger-soft)--mlf-report-error-colorvar(--mlf-color-danger)
shell component tokens Token Default --mlf-shell-colorvar(--mlf-color-text)--mlf-shell-bgtransparent--mlf-shell-overlaylinear-gradient(180deg, color-mix(in srgb, var(--mlf-color-surface) 0%, transparent), var(--mlf-color-overlay) 50%)--mlf-shell-panel-bgvar(--mlf-color-surface)--mlf-shell-panel-bordervar(--mlf-color-border)--mlf-shell-panel-shadow-softvar(--mlf-shadow-sm)--mlf-shell-panel-shadowvar(--mlf-shadow-md)--mlf-shell-header-bgvar(--mlf-color-surface)--mlf-shell-header-blur0px--mlf-shell-action-bgvar(--mlf-color-surface-muted)--mlf-shell-left-min-width22rem--mlf-shell-left-max-width48rem--mlf-shell-right-min-width24rem
hero component tokens Token Default --mlf-hero-bgradial-gradient(circle at top left, var(--mlf-color-accent-soft), transparent 34%), linear-gradient(135deg, color-mix(in srgb, var(--mlf-color-surface) 95%, transparent), color-mix(in srgb, var(--mlf-color-surface) 95%, var(--mlf-color-surface-muted)))--mlf-hero-bordercolor-mix(in srgb, var(--mlf-color-border) 90%, var(--mlf-color-surface))--mlf-hero-shadowvar(--mlf-shadow-lg)--mlf-hero-radiusvar(--mlf-radius-xl)--mlf-hero-eyebrow-colorvar(--mlf-color-text-muted)--mlf-hero-status-bgvar(--mlf-color-accent-soft)
error component tokens Token Default --mlf-error-bgradial-gradient(circle at top left, color-mix(in srgb, var(--mlf-color-danger) 14%, transparent), transparent 55%), linear-gradient(180deg, color-mix(in srgb, var(--mlf-color-surface) 94%, transparent), color-mix(in srgb, var(--mlf-color-surface) 88%, transparent))--mlf-error-bordercolor-mix(in srgb, var(--mlf-color-danger) 20%, transparent)--mlf-error-colorvar(--mlf-color-danger)
toggle component tokens Token Default --mlf-toggle-bgvar(--mlf-input-bg)--mlf-toggle-bordervar(--mlf-input-border)--mlf-toggle-textvar(--mlf-color-text)--mlf-toggle-accentvar(--mlf-color-accent)
status component tokens Token Default --mlf-status-bgvar(--mlf-color-accent-soft)--mlf-status-colorvar(--mlf-color-text-muted)
chart component tokens Token Default --mlf-chart-track-bgvar(--mlf-color-chart-track)--mlf-chart-fill-bgvar(--mlf-color-accent)
mlfTokenKeys lists every key, and defineGlobalTokens and defineComponentTokens type-check token
maps when you write custom themes and recipes .