isIntent
Commons
stable
Type guard that narrows a TColor | TIntent value to TIntent. Returns true when the value is a known semantic intent token (primary, success, danger, …), false for raw CSS colors or null/undefined.
API
Signature
Signature TypeScript complète, extraite du fichier util.
API
Paramètres
Paramètres d'entrée acceptés par cet util.
- vrequisTColor | TIntent | null | undefined
- The color-or-intent value to test. Checked against the internal COLOR_INTENTS Set which contains all semantic intent tokens defined in the design system.
API
Valeur de retour
La valeur retournée par cet util.
- true and narrows the type to TIntent when v is a recognised semantic intent; false for hex colors, CSS values, gradient strings, or nullish values.
Usage
Exemples
Extraits de code prêts à coller.
Distinguishing intents from raw colors