Skip to content
PluginStats

prettier-plugin-tailwind-variants weekly downloads statistics

By tianenpang · npm · Prettier plugins

A Prettier plugin for Tailwind Variants that formats class arrays while preserving structure, then sorts them with prettier-plugin-tailwindcss

View on npm Fresh · Dec 6, 2026

prettier-plugin-tailwind-variants has 47 recorded weekly downloads on npm, an increase of 104% over the past 30 days, ranking #2784 of 3,247 tracked listings.

Weekly downloads
47
Official API · Dec 5, 2026
7-day growth
+74.1%
+20 weekly downloads
30-day growth
+104%
+24 weekly downloads
90-day growth
+292%
+35 weekly downloads
Rank
#2784
▼ 49 in 7 days

About prettier-plugin-tailwind-variants

prettier-plugin-tailwind-variants

<img src="./.github/banner.jpg" alt="prettier-plugin-tailwind-variants" />

A Prettier plugin for Tailwind Variants. Formats tv() class arrays while preserving structure, then sorts with prettier-plugin-tailwindcss.

npm version License: MIT CI

Installation

pnpm add -D prettier prettier-plugin-tailwindcss@^0.8.0 prettier-plugin-tailwind-variants
// prettier.config.js
import * as tailwindcss from 'prettier-plugin-tailwindcss';
import tailwindVariants from 'prettier-plugin-tailwind-variants';

/** @type {import('prettier').Config} */
export default {
  plugins: [tailwindVariants(tailwindcss)],
  tailwindFunctions: ['tv'],
  tvFunctions: ['tv']
};

Must be composed with prettier-plugin-tailwindcss as above.

Options

OptionDefaultDescription
tvFunctions['tv']Callee names to format. Keep tailwindFunctions in sync for string sorting.
tvUnwrapSingleClassArraystrueUnwrap nested single-class arrays into the parent sort pool. Ignored when grouping or flattening.
tvGroupByModifiersfalseSplit tokens into one string per modifier group (base, hover, dark, …).
tvModifierGroupOrderbuilt-inGroup id order when grouping is on. Ignored when grouping is off.
tvFlattenToStringfalseFlatten arrays / nests into a single class string. Ignored for final shape when grouping is on.
tvRemoveEmptyClassestrueRemove empty / whitespace-only class strings and empty arrays.
tvGroupByBreakpointsfalseWhen grouping, put each breakpoint (sm, md, …) in its own group. Ignored when grouping is off.

Shape priority: tvGroupByModifiers → else tvFlattenToString → else preserve structure (+ unwrap).

// tvGroupByModifiers: true
base: ['dark:bg-black', 'px-4', 'hover:bg-red-500', 'py-2'];
// →
base: ['px-4 py-2', 'hover:bg-red-500', 'dark:bg-black'];

// tvFlattenToString: true
base: ['text-white', ['py-2', 'px-4'], 'rounded-lg'];
// →
base: 'rounded-lg px-4 py-2 text-white';

Formatting

// Before
tv({
  base: ['text-white', ['py-2', 'px-4'], 'rounded-lg']
});

// After (default structure mode)
tv({
  base: ['rounded-lg', ['px-4', 'py-2'], 'text-white']
});

Covers base, slots, variants, compoundVariants / compoundSlots (class / className). JS/TS and <script> regions (Vue, Svelte, Astro, HTML, …); CSS is left alone. Framework parsers need their own Prettier plugins.

Editor IntelliSense

Prefer key-scoped classRegex over classFunctions: ["tv"] so conditions and defaultVariants are skipped. Copy from .vscode/settings.json and enable "editor.quickSuggestions": { "strings": "on" }.

{
  "tailwindCSS.experimental.classRegex": [
    ["\\b(?:base|class|className)\\s*:\\s*['\"`]([^'\"`]*)['\"`]"],
    [
      "\\b(?:base|class|className)\\s*:\\s*(\\[(?:[^\\[\\]]|\\[(?:[^\\[\\]]|\\[(?:[^\\[\\]]|\\[[^\\[\\]]*\\])*\\])*\\])*\\])",
      "['\"`]([^'\"`]*)['\"`]"
    ],
    ["\\b(?:class|className)\\s*:\\s*(\\{(?:[^{}]|\\{[^{}]*\\})*\\})", "['\"`]([^'\"`]*)['\"`]"],
    ["\\bslots\\s*:\\s*(\\{(?:[^{}]|\\{[^{}]*\\})*\\})", "['\"`]([^'\"`]*)['\"`]"],
    [
      "\\bvariants\\s*:\\s*(\\{(?:[^{}]|\\{(?:[^{}]|\\{(?:[^{}]|\\{[^{}]*\\})*\\})*\\})*\\})",
      "['\"`]([^'\"`]*)['\"`]"
    ]
  ]
}

Limitations

  • Static strings and literal arrays only
  • Dynamic values skip that array
  • Peers: prettier@^3.0.0, prettier-plugin-tailwindcss@^0.8.0

Community

Contributing · Code of Conduct · Security · Support

License

MIT

Description from the npm listing.

  • prettier
  • prettier-plugin
  • tailwind
  • tailwindcss
  • tailwind-variants
  • formatting
  • class-sorting
  • variants

README badge

Show your rank in a README or on your website. The badge updates automatically.

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

prettier-plugin-tailwind-variants weekly downloads on npm, last 90 days: 47 weekly downloads as of Dec 5, 2026, +292% over 90 days.prettier-plugin-tailwind-variantsWeekly downloads on npm · Last 90 days47downloads / week+292% over 90 days0102030405060Sep 6Sep 21Oct 6Oct 21Nov 5Nov 20Dec 5downloads / weekobservedarchived (Internet Archive)no observationsSep 7, 2026 – Dec 5, 2026 · 90 observations · Updated Dec …pluginstats.com
prettier-plugin-tailwind-variants weekly downloads on npm, last 90 days: 47 weekly downloads as of Dec 5, 2026, +292% over 90 days.

7/30/90-day growth

prettier-plugin-tailwind-variants weekly downloads growth on npm: +74.1% over 7 days, +104% over 30 days, +292% over 90 days.prettier-plugin-tailwind-variantsWeekly downloads growth on npm47downloads / week now7-day growth+20 weekly downloads+74.1%30-day growth+24 weekly downloads+104%90-day growth+35 weekly downloads+292%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
prettier-plugin-tailwind-variants weekly downloads growth on npm: +74.1% over 7 days, +104% over 30 days, +292% over 90 days.

Ranking history

prettier-plugin-tailwind-variants npm ranking history: currently #2784 (by weekly downloads).prettier-plugin-tailwind-variantsnpm ranking · by weekly downloads · Last 90 days#2784current rank#500#1000#1500#2000#2500#3000Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 17, 2026 – Dec 6, 2026 · 45 observations · Updated Dec 5, 2026pluginstats.com
prettier-plugin-tailwind-variants npm ranking history: currently #2784 (by weekly downloads).

Listing placement

All npm3,247 listings · 163 pages · 1,084 shown · page 140, #4 (overall #2,784)
All npm: every listing in weekly downloads order

Listing placement

Prettier plugins267 listings · 14 pages · page 6, #18 (overall #118)
Prettier plugins: every listing in weekly downloads order

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

Recent observations

Full history (592)
Recent weekly downloads observations for prettier-plugin-tailwind-variants
Date (UTC)Weekly downloadsChange vs. previous
470
47+2
45+20
25-3
28+1
27+1
26-1
27+2
25+3
22+2
20-19
39-10
490
49—

Similar npm Prettier plugins plugins

All 20 prettier-plugin-tailwind-variants alternatives

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/prettier-plugin-tailwind-variants. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.