Skip to content

Cratis token reference

The --cratis-* variables are the supported theming boundary. The tokens entry supplies conservative light defaults so an unthemed surface remains usable. A product design system overrides them directly; the optional theme entry adds dark, forced-colors, and scoped-subtree behavior.

Token Purpose
--cratis-primary-color Accent, links, selected controls, and non-text indicators.
--cratis-primary-color-text Content on the accent color where used.
--cratis-primary-300 … --cratis-primary-600 Accent scale used by specialized surfaces.
--cratis-primary-600-text Content on the fixed --cratis-primary-600 tone.
--cratis-green-500 Success state.
--cratis-orange-500 Warning state.
--cratis-red-500 Error/destructive indicator.
--cratis-action-background / -hover / -active Primary-action state fills.
--cratis-action-text Text/icons on the primary action.
--cratis-info-background / --cratis-info-text Info badge/tag background and text pair.
--cratis-success-background / --cratis-success-text Success background and text pair.
--cratis-warning-background / --cratis-warning-text Warning background and text pair.
--cratis-danger-background / --cratis-danger-text Danger background and text pair.
Token Purpose
--cratis-surface-ground Application/page background.
--cratis-surface-section Grouped section background.
--cratis-surface-card Cards and raised content.
--cratis-surface-overlay Dialogs, dropdowns, popovers, and toasts.
--cratis-surface-hover Hovered or quiet selected state.
--cratis-surface-border Borders and dividers.
--cratis-surface-0 / --cratis-surface-100 Small neutral ramp used by display components.
--cratis-control-background Inputs, Dropdown triggers, and segmented date controls.
--cratis-control-border Visible control boundary, intentionally stronger than quiet surface borders.
Token Purpose
--cratis-text-color Primary text.
--cratis-text-color-secondary Supporting text and placeholders.
--cratis-highlight-bg Selected/highlighted background.
--cratis-highlight-text-color Text on a highlighted background.
--cratis-focus-ring Keyboard-visible focus treatment.
--cratis-focus-outline / -offset Optional outline hook for focus; defaults to none and 0.
--cratis-focus-ring-inset Optional inward focus ring for list and menu items; unset, they use an inset --cratis-focus-ring.
--cratis-{info,success,warning,danger}-foreground Optional text color of outline, ghost, and link status buttons; unset, they use the matching -background token.
--cratis-maskbg Modal backdrop.
--cratis-border-radius Default component radius.
--cratis-corner-sm / -lg / -xl / -full Radius scale (4px, 8px, 12px, 999px); not yet read by every component stylesheet.
--cratis-font-size-xs / -sm / -md Type scale (0.75rem, 0.875rem, 1rem); not yet read by every component stylesheet.
--cratis-type-weight-medium / -semibold / -bold Font weights (500, 600, 700); not yet read by every component stylesheet.
--cratis-control-height / -small / -large Interactive control size floor.
--cratis-disabled-opacity Shared disabled-state opacity.
--cratis-shadow-subtle Small control elevation.
--cratis-shadow-overlay Dropdown, DatePicker, filter, Toolbar panel, and tooltip elevation.
--cratis-shadow-dialog Dialog elevation.
--cratis-shadow-toast Toast elevation.

A few tokens tune one component. The first three have defaults in tokens; the rest are not defined anywhere, and the component falls back to the listed value until you set them.

Token Default Surface
--cratis-number-input-adornment-color var(--cratis-text-color-secondary) NumberInput prefix and suffix text.
--cratis-number-input-step-background var(--cratis-surface-100) NumberInput step buttons.
--cratis-number-input-step-background-hover var(--cratis-surface-hover) Hovered NumberInput step button.
--cratis-shadow-card none (fallback) Selected ToggleGroup option.
--cratis-filter-option-list-max-height 14rem (fallback) CheckboxListFilter option list (Filter and PivotViewer).
--cratis-canvas-minimap-grid-color var(--cratis-surface-border) (fallback) Canvas minimap dot grid.
--cratis-canvas-minimap-item-color var(--cratis-text-color) at 25% (fallback) Canvas minimap items without their own color.
--cratis-font-mono ui-monospace, SFMono-Regular, Menlo, Consolas, monospace (fallback) MarkdownEditor source textarea and the detail text in its suggestion list.

SchemaEditor colors its type chips with its own tokens. Unlike the tokens above, the stylesheet declares them on .cratis-schema-editor and .cratis-schema-editor__menu (the type menu), not on :root, so a value set on :root is ignored. Override them on both selectors:

.cratis-schema-editor,
.cratis-schema-editor__menu {
--cratis-schema-editor-type-number: #9f1239;
}
Token Default Chip
--cratis-schema-editor-type-string #0e7490 Text.
--cratis-schema-editor-type-number #b91c1c Number.
--cratis-schema-editor-type-boolean #15803d Boolean.
--cratis-schema-editor-type-date #c2410c Date.
--cratis-schema-editor-type-time #7c6d14 Time.
--cratis-schema-editor-type-unique-identifier #0f766e Unique identifier.
--cratis-schema-editor-type-object #6d28d9 Object.
--cratis-schema-editor-type-string-array #0f766e List of text.
--cratis-schema-editor-type-number-array #991b1b List of numbers.
--cratis-schema-editor-type-object-array #5b21b6 List of objects.
--cratis-schema-editor-type-text #fff Glyph text on every type chip.
--cratis-schema-editor-concept-background #b4a5ff Concept name background in the badge.
--cratis-schema-editor-concept-text #1c1040 Concept name text in the badge.
Token Default Surface
--cratis-z-index-dialog 1100 Dialog backdrop/root.
--cratis-z-index-overlay 1200 Dropdown and DatePicker overlays.
--cratis-z-index-filter 1250 Column filter menus.
--cratis-z-index-tooltip 1300 Tooltips.
--cratis-z-index-toast 1400 Toast regions.

Keep their relative order when mapping into an application’s overlay system. A mixed Prime/product application with overlays around 10000 can move the complete Components range together:

:root {
--cratis-z-index-dialog: 11000;
--cratis-z-index-overlay: 11100;
--cratis-z-index-filter: 11150;
--cratis-z-index-tooltip: 11200;
--cratis-z-index-toast: 11300;
}

These tokens coordinate Components only. Configure direct Prime or product overlays independently.

:root {
--cratis-primary-color: var(--product-accent-700);
--cratis-primary-color-text: var(--product-text-inverse);
--cratis-action-background: var(--product-action);
--cratis-action-background-hover: var(--product-action-hover);
--cratis-action-background-active: var(--product-action-active);
--cratis-action-text: var(--product-on-action);
--cratis-surface-ground: var(--product-canvas);
--cratis-surface-card: var(--product-surface);
--cratis-surface-overlay: var(--product-surface-raised);
--cratis-surface-hover: var(--product-subtle);
--cratis-surface-border: var(--product-border);
--cratis-control-background: var(--product-control);
--cratis-control-border: var(--product-control-border);
--cratis-text-color: var(--product-text-primary);
--cratis-text-color-secondary: var(--product-text-secondary);
--cratis-focus-ring: var(--product-focus-ring);
}

This mapping assumes the product omits @cratis/components/theme. With the baseline theme imported, its scheme selectors are more specific than :root; see Customize the palette for selectors that win there.

The token layer has renderer-independent baseline values and does not read legacy --surface-*, --text-color, --primary-color, or --p-* names. Import @cratis/components/tokens first, then assign product values to --cratis-* directly. This keeps product theming independent of any renderer token vocabulary.

Test contrast for every overridden foreground/background pair in each appearance mode the application supports. Token names and baseline values do not establish accessibility conformance for an application theme.

Use Stable component parts when token changes are not enough for a product-specific component treatment.