Skip to content

noTailwindArbitraryValue

biome.json
{
"linter": {
"rules": {
"nursery": {
"noTailwindArbitraryValue": "error"
}
}
}
}

Disallow arbitrary values in Tailwind CSS utility classes.

Arbitrary values (e.g. w-[400px], text-[#555]) and arbitrary properties (e.g. [color:red]) bypass Tailwind’s configured theme scales. This rule reports them so teams can keep styling constrained to named utilities from their Tailwind configuration.

<div class="w-[400px]"></div>
code-block.html:1:15 lint/nursery/noTailwindArbitraryValue ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Found an arbitrary value in a Tailwind CSS class.

> 1 │ <div class=“w-[400px]”></div>
^^^^^^^
2 │

Arbitrary values bypass Tailwind’s theme configuration, defeating design-system consistency and making styles harder to refactor.

Use a named utility from your Tailwind configuration instead.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

<div class="text-[#555] bg-white"></div>
code-block.html:1:18 lint/nursery/noTailwindArbitraryValue ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Found an arbitrary value in a Tailwind CSS class.

> 1 │ <div class=“text-[#555] bg-white”></div>
^^^^^^
2 │

Arbitrary values bypass Tailwind’s theme configuration, defeating design-system consistency and making styles harder to refactor.

Use a named utility from your Tailwind configuration instead.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

<div class="[color:red]"></div>
code-block.html:1:13 lint/nursery/noTailwindArbitraryValue ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Found an arbitrary value in a Tailwind CSS class.

> 1 │ <div class=“[color:red]”></div>
^^^^^^^^^^^
2 │

Arbitrary values bypass Tailwind’s theme configuration, defeating design-system consistency and making styles harder to refactor.

Use a named utility from your Tailwind configuration instead.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

<div class="w-4 text-red-500 bg-white"></div>
<div class="[&:nth-child(3)]:px-2"></div>

By default, this rule checks the class attribute. The attributes option adds more HTML attributes to check.

biome.json
{
"linter": {
"rules": {
"nursery": {
"noTailwindArbitraryValue": {
"level": "on",
"options": {
"attributes": [
"classList"
]
}
}
}
}
}
}
<div classList="w-[400px]"></div>

Additional HTML attribute names to check.

Default: [] (the class attribute is always checked).