# useTailwindSortedClasses

Rule `biome/useTailwindSortedClasses`. Enforce the sorting of Tailwind CSS classes.

- Source: biome
- Technologies: Tailwind CSS
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 2.1M weekly downloads of presets that enable it
- Trend: +151.7% last quarter
- Rank: #1560 by reach, #64 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| Biome | `nursery/useTailwindSortedClasses` | no | unsafe | group nursery, since 1.6.0 | [docs](https://biomejs.dev/linter/rules/use-tailwind-sorted-classes/) |

## Code examples

### Incorrect: the rule reports this

```jsx
<div class="px-2 foo p-4 bar" />;
```

```jsx
<div class="hover:focus:m-2 foo hover:px-2 p-4" />
```

### Correct: the rule accepts this

```jsx
<div class="foo bar p-4 px-2" />;
```

Examples from the Biome documentation.

## Enable it

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "nursery": {
        "useTailwindSortedClasses": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Ultracite for Biome](https://lintradar.dev/presets/ultracite-biome.md) | Biome | `ultracite` | 616 | 2.1M | +151.7% |

## Related rules

- [biome/useStaticResponseMethods](https://lintradar.dev/rules/biome/useStaticResponseMethods.md): Use static `Response` methods instead of `new Response()` constructor when possible.
- [biome/useTopLevelRegex](https://lintradar.dev/rules/biome/useTopLevelRegex.md): Require regex literals to be declared at the top level.
- [biome/useSimplifiedLogicExpression](https://lintradar.dev/rules/biome/useSimplifiedLogicExpression.md): Discard redundant terms from logical expressions.
- [biome/useRequiredScripts](https://lintradar.dev/rules/biome/useRequiredScripts.md): Require configured scripts in `package.json`.
- [biome/useNodeAssertStrict](https://lintradar.dev/rules/biome/useNodeAssertStrict.md): Prefer `node:assert/strict` over `node:assert`.
- [biome/useLoneExecutableDefinition](https://lintradar.dev/rules/biome/useLoneExecutableDefinition.md): Require one executable GraphQL definition per file.

---

Web page: https://lintradar.dev/rules/biome/useTailwindSortedClasses. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
