Skip to content

no-arbitrary-spacing

Reports margin, padding, and gap written as arbitrary values, such as p-[13px].

This rule reports margin, padding, or gap written as an arbitrary value, such as p-[13px]. The CSS works, but the value is not on your spacing scale. No preset enables this rule.

Reported

style("p-[13px]");no-arbitrary-spacing: arbitrary spacing `13px` is forbidden for `padding`; use the spacing scale or a custom property

Fixed

@theme {
  --spacing-panel: 13px;
}
style("p-panel");

How to fix

  • Give the value a theme name for its role, as in the example. This keeps the same 13px padding while making it available to other components.
  • Use an existing spacing value if the design allows a different size.

Options

properties lists more CSS properties to check, in addition to margin, padding, and gap.

Rule settings

PresetSeverity
recommendedoff
strictoff
stylisticoff
OptionDefault
properties[]

Configure lint to change the severity or options.