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.

TokenPurpose
--cratis-primary-colorAccent, links, selected controls, and non-text indicators.
--cratis-primary-color-textContent on the accent color where used.
--cratis-primary-300--cratis-primary-600Accent scale used by specialized surfaces.
--cratis-primary-600-textContent on the fixed --cratis-primary-600 tone.
--cratis-green-500Success state.
--cratis-orange-500Warning state.
--cratis-red-500Error/destructive indicator.
--cratis-action-background / -hover / -activePrimary-action state fills.
--cratis-action-textText/icons on the primary action.
--cratis-info-background / --cratis-info-textInfo badge/tag background and text pair.
--cratis-success-background / --cratis-success-textSuccess background and text pair.
--cratis-warning-background / --cratis-warning-textWarning background and text pair.
--cratis-danger-background / --cratis-danger-textDanger background and text pair.
TokenPurpose
--cratis-surface-groundApplication/page background.
--cratis-surface-sectionGrouped section background.
--cratis-surface-cardCards and raised content.
--cratis-surface-overlayDialogs, dropdowns, popovers, and toasts.
--cratis-surface-hoverHovered or quiet selected state.
--cratis-surface-borderBorders and dividers.
--cratis-surface-0 / --cratis-surface-100Small neutral ramp used by display components.
--cratis-control-backgroundInputs, Dropdown triggers, and segmented date controls.
--cratis-control-borderVisible control boundary, intentionally stronger than quiet surface borders.
TokenPurpose
--cratis-text-colorPrimary text.
--cratis-text-color-secondarySupporting text and placeholders.
--cratis-highlight-bgSelected/highlighted background.
--cratis-highlight-text-colorText on a highlighted background.
--cratis-focus-ringKeyboard-visible focus treatment.
--cratis-maskbgModal backdrop.
--cratis-border-radiusDefault component radius.
--cratis-control-height / -small / -largeInteractive control size floor.
--cratis-disabled-opacityShared disabled-state opacity.
--cratis-shadow-subtleSmall control elevation.
--cratis-shadow-overlayDropdown, DatePicker, filter, Toolbar panel, and tooltip elevation.
--cratis-shadow-dialogDialog elevation.
--cratis-shadow-toastToast elevation.
TokenDefaultSurface
--cratis-z-index-dialog1100Dialog backdrop/root.
--cratis-z-index-overlay1200Dropdown and DatePicker overlays.
--cratis-z-index-filter1250Column filter menus.
--cratis-z-index-tooltip1300Tooltips.
--cratis-z-index-toast1400Toast 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);
}

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.