This rule reports an argument of style() that the compiler cannot compile, such
as a number or a style() call written inside another style() call. The
argument adds nothing to the element. A number alone supplies neither a CSS
property nor a unit. The example intends to set a width in pixels.
Reported
style(42);invalid-style-input: style() accepts literal utility strings, arrays, `condition && "…"` branches, and variant wrappersFixed
style("w-[42px]");How to fix
- For a value that you know when you write the code, use a utility, as in the example, or a theme value.
- For a value that changes at runtime, set a custom property and read it in a
utility, such as
w-(--width). - Store a
style()result in a variable before you pass it to another call.
style() lists the accepted inputs.
Rule settings
| Preset | Severity |
|---|---|
recommended | deny |
strict | deny |
stylistic | off |
Configure lint to change the severity or options.