This rule reports a runtime condition, such as && or a ternary, inside the base
or an option value of style.recipe(). The compiler generates
every value when it creates the factory, so the condition cannot choose a style.
Reported
declare const active: boolean;
style.recipe(active && "bg-blue-500");invalid-recipe-input: style.recipe() values require static utilities, arrays, CSS variants, or custom properties; utility inputs cannot use `&&` or ternary expressionsFixed
declare const active: boolean;
const button = style.recipe("", {
variants: {
active: {
true: "bg-blue-500",
false: null,
},
},
});
button({ active });How to fix
- Turn the condition into an option, and pass the current value when you call the factory, as in the example.
- Stored
style()results, refs, animations, andclassfields are not accepted either. Use them instyle()instead.
See style.recipe().
Rule settings
| Preset | Severity |
|---|---|
recommended | deny |
strict | deny |
stylistic | off |
Configure lint to change the severity or options.