Skip to content
PluginStats

prettier-plugin-tv-groups weekly downloads statistics

By ivankhludov · npm · Prettier plugins

Prettier plugin: group tailwind-variants tv() base classes by modifier buckets

View on npm Fresh · Dec 5, 2026

prettier-plugin-tv-groups has 4 recorded weekly downloads on npm, unchanged over the past 30 days, ranking #3233 of 3,247 tracked listings.

Weekly downloads
4
Official API · Dec 5, 2026
7-day growth
-33.3%
-2 weekly downloads
30-day growth
0.0%
0 weekly downloads
90-day growth
-50.0%
-4 weekly downloads
Rank
#3233
▼ 165 in 7 days

About prettier-plugin-tv-groups

prettier-plugin-tv-groups

Prettier 3 plugin for tailwind-variants: it reorders the base field of tv({ ... }) (and other names you configure) into one string per modifier group (plain utilities, hover:, dark:, responsive prefixes, aria-, data-, etc.). The order of groups follows a fixed list inside the plugin; within each string, classes keep a stable order so a tool like prettier-plugin-tailwindcss can sort them afterward.

Example

Before — dozens of classes in arbitrary order, all in one base string (typical copy-paste / merge mess):

const button = tv({
  base: "dark:hover:bg-slate-800 aria-busy:pointer-events-none md:flex data-[state=open]:animate-in focus-visible:ring-2 lg:inline-flex hover:bg-primary/90 border-transparent disabled:opacity-50 dark:text-white shrink-0 active:scale-95 px-4 py-2 rounded-full size-10 border-2 focus-visible:outline-none shadow-sm text-sm font-medium transition-colors disabled:pointer-events-none dark:bg-slate-900 focus-visible:ring-offset-2",
  variants: {},
});

After Prettier runs with this plugin — base becomes an array of strings: plain layout/typography together, then hover:, focus-visible:, active:, disabled:, aria-, data-, breakpoints (md:, lg:), dark:, in a fixed group order decided by the plugin:

const button = tv({
  base: [
    "border-transparent shrink-0 px-4 py-2 rounded-full size-10 border-2 shadow-sm text-sm font-medium transition-colors",
    "hover:bg-primary/90",
    "focus-visible:ring-2 focus-visible:outline-none focus-visible:ring-offset-2",
    "active:scale-95",
    "disabled:opacity-50 disabled:pointer-events-none",
    "aria-busy:pointer-events-none",
    "data-[state=open]:animate-in",
    "md:flex lg:inline-flex",
    "dark:hover:bg-slate-800 dark:text-white dark:bg-slate-900",
  ],
  variants: {},
});

You can see at a glance which bucket a class belongs to; diffs stay localized to one array element when you tweak e.g. only dark mode. If you also use prettier-plugin-tailwindcss, it can sort names inside each string in the same format pass. A base that stays one literal is unchanged until you format with this plugin.

Requirements

  • Node.js >= 18
  • Prettier 3.8.1 (see peerDependencies in this package)

Install

npm add -D prettier-plugin-tv-groups

Pin Prettier to the same major line your project already uses; this repo is tested with Prettier 3.8.1.
prettier-plugin-tailwindcss is an optional peer — add it when you want Tailwind class sorting in the same format run.

Which files are handled

The plugin only hooks Prettier’s typescript and babel-ts parsers. In practice that is mainly .ts / .tsx, and .jsx when Prettier uses babel-ts. Plain .js often uses the babel parser; this package does not wrap that parser, so tv() grouping may not run unless you force a compatible parser (for example via overrides in your Prettier config).

Configure Prettier

Standalone (no Tailwind sorting) — .prettierrc or prettier.config with JSON:

{
  "plugins": ["prettier-plugin-tv-groups"]
}
Option: tvGroupsFunctionNames

Array of local callee names to treat like tv. Default: ["tv"].

  • Only simple calls name({ base: ... }) are handled (Identifier callee, not foo.tv()).
  • If you use a single alias and no tv, set e.g. ["createVariants"] — then tv is not transformed unless you include it in the array.
  • [] disables grouping for this plugin.

Example:

{
  "plugins": ["prettier-plugin-tv-groups"],
  "tvGroupsFunctionNames": ["tv", "createVariants"]
}
With prettier-plugin-tailwindcss

prettier-plugin-tailwindcss is expected to be the last plugin in plugins. If you list prettier-plugin-tv-groups as a separate entry, Prettier may end up never running this plugin’s parsers, or you break Tailwind’s “last plugin” rule — so the supported approach is to attach tv-groups onto the Tailwind plugin.

Use a JavaScript config (for example prettier.config.mjs) and import attachTvGroupsToTailwind from the subpath prettier-plugin-tv-groups/attach-to-tailwind. Pass the namespace import of Tailwind’s plugin (import * as tailwindPlugin from "prettier-plugin-tailwindcss"), not a default export.

import * as tailwindPlugin from "prettier-plugin-tailwindcss";
import { attachTvGroupsToTailwind } from "prettier-plugin-tv-groups/attach-to-tailwind";

export default {
  plugins: [attachTvGroupsToTailwind(tailwindPlugin)],
  tailwindFunctions: ["tv"],
};

Add every name from tvGroupsFunctionNames to tailwindFunctions if you want class sorting inside those calls too.

If you use @ianvs/prettier-plugin-sort-imports, keep it before the combined Tailwind + tv-groups entry so import sorting still runs first.

The default export (prettier-plugin-tv-groups alone) is still useful for tests or when Tailwind is not loaded; it tries to delegate to Tailwind’s typescript / babel-ts parsers when that package is installed, but with both plugins listed separately, ordering is fragile — prefer attachTvGroupsToTailwind for day-to-day projects.

What gets rewritten

  • First argument to the call must be an object literal with a base property.
  • base may be a string literal or an array of string literals only (no template literals with ${}, spreads, or arbitrary expressions).

Renamed imports are not inferred: you must add the local name via tvGroupsFunctionNames.

Development

npm test
npm run lint

License

Licensed under the MIT License.

Description from the npm listing.

  • prettier
  • prettier-plugin
  • tailwind
  • tailwind-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-tv-groups weekly downloads on npm, last 90 days: 4 weekly downloads as of Dec 5, 2026, -50.0% over 90 days.prettier-plugin-tv-groupsWeekly downloads on npm · Last 90 days4downloads / week-50.0% over 90 days0123456Sep 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-tv-groups weekly downloads on npm, last 90 days: 4 weekly downloads as of Dec 5, 2026, -50.0% over 90 days.

7/30/90-day growth

prettier-plugin-tv-groups weekly downloads growth on npm: -33.3% over 7 days, 0.0% over 30 days, -50.0% over 90 days.prettier-plugin-tv-groupsWeekly downloads growth on npm4downloads / week now7-day growth-2 weekly downloads-33.3%30-day growth+0 weekly downloads0.0%90-day growth-4 weekly downloads-50.0%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
prettier-plugin-tv-groups weekly downloads growth on npm: -33.3% over 7 days, 0.0% over 30 days, -50.0% over 90 days.

Ranking history

prettier-plugin-tv-groups npm ranking history: currently #3233 (by weekly downloads).prettier-plugin-tv-groupsnpm ranking · by weekly downloads · Last 90 days#3233current rank#2000#2200#2400#2600#2800#3000#3200#3400Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 18, 2026 – Dec 6, 2026 · 36 observations · Updated Dec 5, 2026pluginstats.com
prettier-plugin-tv-groups npm ranking history: currently #3233 (by weekly downloads).

Listing placement

All npm3,247 listings · 163 pages · 1,083 shown · page 162, #15 (overall #3,235)
All npm: every listing in weekly downloads order

Listing placement

Prettier plugins267 listings · 14 pages · page 14, #3 (overall #263)
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 (170)
Recent weekly downloads observations for prettier-plugin-tv-groups
Date (UTC)Weekly downloadsChange vs. previous
40
4-1
5+2
3-2
5+1
40
4-2
60
6+1
5-1
6+1
50
50
5—

Similar npm Prettier plugins plugins

All 20 prettier-plugin-tv-groups 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-tv-groups. First seen Oct 16, 2026; last successful collection Dec 5, 2026. See the methodology.