Skip to content

invalid-style-input

Reports a style() argument that the compiler cannot compile, such as a number.

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 wrappers

Fixed

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

PresetSeverity
recommendeddeny
strictdeny
stylisticoff

Configure lint to change the severity or options.