Automatically sort Tailwind classes on save. Use your preferred sort order to keep your classes organized.
Custom sort order and categories can be configured in settings.
File > Preferences > Settings
Tailwind Sorter: Category Order
: The order categories will be sorted.Tailwind Sorter: Categories
: Which style classes will belong to which category and in what order.Tailwind Sorter: Pseudo Classes Order
: How pseudo-classes should be ordered.Tailwind Sorter: Custom Prefixes
: Prefixes that identify class strings other than the default class=
and className=
.The default category order is: box model, grid, flexbox, background, margins and padding, borders, width and height, typography, transformations, and other`.
The default order for pseudo-classes order is: screens (sm, md, lg, xl, 2xl), before and after pseudo-elements, states (hover, focus, active, visited, disabled), dark mode, child selectors (first, last, odd, even), group states (group-over, group-focus), and motion preferences (motion-safe, motion-reduce).
Category example:
"box": [
"group",
"block",
"relative",
"top",
"right",
"bottom",
"left",
"z-",
"float",
"clear",
"box-border",
"static",
"fixed",
"absolute",
"sticky",
"inset-",
],
Custom Prefixes: Tailwind Sorter checks for class=
and className=
as well as any custom prefixes defined in settings. Default custom prefixes include: twMerge(
, cva(
, and clsx(
The extension sorts any strings that are preceded by a prefix and do not included dynamic syntax
""
''
``
Custom prefixes
class=
className=
?
<
>
{
Currently, Tailwind Sorter supports .html
, .jsx
, .tsx
, .ex
, .heex
, .vue
, .rs
, and .astro
files. If you would like to see support for an additional language, please open an issue (or submit a PR).
If you don't need control over the sort order, the prettier plugin is recommended.
prettier-plugin-tailwindcss
from plugins: []
in your prettier config file and reload window.