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
Full TypeScript signature sourced from the util file.
API
Parameters
Input parameters accepted by this util.
- vrequiredTColor | 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
Return value
The value returned by this 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
Examples
Ready-to-paste usage snippets.
Distinguishing intents from raw colors