isUtilityIntent

Commons
stable

Type guard that narrows to the subset of TIntent values for which the design system ships a global utility class (.origam--bg-<intent> / .origam--color-<intent>). The "ghost" intent is intentionally excluded.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

The distinction between isIntent and isUtilityIntent exists because "ghost" is a valid semantic intent but does not ship a utility class in the current token set. Use isUtilityIntent when deciding whether to emit a class vs an inline style.

API

Parameters

Input parameters accepted by this util.

v
required
TColor | TIntent | null | undefined
The value to test. Checked against the internal COLOR_UTILITY_INTENTS Set, which excludes "ghost" and any intent without a matching utility class.

API

Return value

The value returned by this util.

true and narrows the type to TIntent when v is an intent that has a corresponding utility CSS class; false for raw colors, ghost, and nullish values.

Usage

Examples

Ready-to-paste usage snippets.

Checking whether an intent has a utility class

typescript