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

Signature TypeScript complète, extraite du fichier util.

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

Paramètres

Paramètres d'entrée acceptés par cet util.

v
requis
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

Valeur de retour

La valeur retournée par cet 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

Exemples

Extraits de code prêts à coller.

Checking whether an intent has a utility class

typescript