{
 "kind": "tool",
 "slug": "tailwind-variants",
 "path": "tools/tailwind-variants/",
 "name": "tailwind-variants",
 "maker": null,
 "density": "profile",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "Styling and CSS",
   "tools/styling/"
  ]
 ],
 "lead": "Compose Tailwind CSS classes conditionally with a variant-first composition API.",
 "chips": [
  {
   "label": "Styling and CSS",
   "path": "tools/styling/"
  },
  {
   "label": "NPM"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "npm install tailwind-variants"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/heroui-inc/tailwind-variants"
  },
  {
   "label": "Website",
   "href": "https://github.com/heroui-inc/tailwind-variants#readme"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "MIT",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": null,
   "note": "License from npm.",
   "src": "https://github.com/heroui-inc/tailwind-variants"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Maintained",
   "status": "yes",
   "sub": "Last change Nov 10, 2026",
   "note": "Latest GitHub release Nov 10, 2026. ",
   "src": "https://github.com/heroui-inc/tailwind-variants"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "45 projects",
   "status": "info",
   "sub": "#5 of 53 in its category",
   "note": "Dependency in 45 public GitHub projects set up for AI coding agents that we scanned (0.7%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Docs for agents",
   "status": "yes",
   "sub": "llms.txt",
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": "https://tailwind-variants.org/llms.txt"
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What tailwind-variants does",
   "parts": [
    {
     "t": "prose",
     "text": "Tailwind Variants puts class-conflict merging and named per-part slots into one typed recipe function, and offers a separate lite build that drops merging for a smaller bundle."
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "tailwind-variants popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "60",
       "of": "/ 100",
       "l": "Gid Score, #995 overall"
      },
      {
       "n": "7.4M",
       "l": "downloads a week, npm"
      },
      {
       "n": "3,335",
       "l": "GitHub stars"
      },
      {
       "n": "45",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How tailwind-variants is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "tailwind-variants is a dependency in 45 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (0.9% of the 4,867 JavaScript/TypeScript ones), #5 of 53 in styling and css.",
      "Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 80; those are left out of every share on this page.",
      "The most used alternative in our scan is Tailwind Merge (1,173 projects).",
      "Projects that use it most often also use Tailwind Merge (88.9%), clsx (86.7%), Tailwind CSS (100.0%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "27 projects, 0.9%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      },
      {
       "l": "25 projects, 0.8%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "20 projects, 0.8%",
       "v": "Cursor",
       "path": "agents/cursor/"
      },
      {
       "l": "5 projects, 1.5%",
       "v": "OpenCode",
       "path": "agents/opencode/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 88.9% of its projects",
       "v": "Tailwind Merge",
       "path": "tools/tailwind-merge/"
      },
      {
       "l": "In 86.7% of its projects",
       "v": "clsx",
       "path": "tools/clsx/"
      },
      {
       "l": "In 100.0% of its projects",
       "v": "Tailwind CSS",
       "path": "tools/tailwindcss/"
      },
      {
       "l": "In 62.2% of its projects",
       "v": "tw-animate-css",
       "path": "tools/tw-animate-css/"
      },
      {
       "l": "In 55.6% of its projects",
       "v": "Svelte",
       "path": "tools/svelte/"
      },
      {
       "l": "In 55.6% of its projects",
       "v": "svelte-check",
       "path": "tools/svelte-check/"
      },
      {
       "l": "In 53.3% of its projects",
       "v": "@internationalized/date",
       "path": "tools/internationalized-date/"
      },
      {
       "l": "In 53.3% of its projects",
       "v": "Bits UI",
       "path": "tools/bits-ui/"
      }
     ]
    }
   ]
  },
  {
   "id": "profile",
   "nav": "Profile",
   "h2": "tailwind-variants in practice",
   "parts": [
    {
     "t": "h3",
     "text": "Strengths"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Slots for multi-part components",
       "v": "One recipe can name parts such as <code>base</code>, <code>icon</code> and <code>label</code>, and each part gets its own classes and variants. The docs' comparison table lists slots and compound slots as features that CVA and Windstitch lack."
      },
      {
       "l": "Class merging without tailwind-merge",
       "v": "Since v3.3, the default build resolves conflicts such as <code>px-2</code> versus <code>px-4</code> on its own. The FAQ says to keep tailwind-merge only if your app imports it directly."
      },
      {
       "l": "A lite build that trades merge for size",
       "v": "Importing from <code>tailwind-variants/lite</code> turns merging off. The FAQ says this build is about 80% smaller."
      },
      {
       "l": "Variant props inferred from the recipe",
       "v": "<code>VariantProps</code> extracts prop types from a recipe. The docs say slotted components get typed slot functions."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Watch out for"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Responsive variants are gone on Tailwind v4",
       "v": "The README notes that Tailwind CSS v4 dropped <code>config.content.transform</code>, so responsive variants were removed. You add breakpoint classes to your class names yourself."
      },
      {
       "l": "Not every helper merges",
       "v": "<code>cx</code> only concatenates class names. In the lite build, <code>cx</code> is the only one of the three helpers available, so conflicting classes stay side by side."
      },
      {
       "l": "One extend parent per recipe",
       "v": "A recipe can inherit from only one other recipe. To combine several bases, you chain extends or join class strings by hand."
      }
     ]
    },
    {
     "t": "h3",
     "text": "A button recipe with variants, a compound rule and defaults"
    },
    {
     "t": "tabs",
     "label": "Example",
     "items": [
      {
       "tab": "Js",
       "code": "import { tv } from \"tailwind-variants\";\n\nconst button = tv({\n  base: \"font-medium bg-blue-500 text-white rounded-full active:opacity-80\",\n  variants: {\n    color: {\n      primary: \"bg-blue-500 text-white\",\n      secondary: \"bg-purple-500 text-white\",\n    },\n    size: {\n      sm: \"text-sm\",\n      md: \"text-base\",\n      lg: \"px-4 py-3 text-lg\",\n    },\n  },\n  compoundVariants: [\n    {\n      size: [\"sm\", \"md\"],\n      class: \"px-3 py-1\",\n    },\n  ],\n  defaultVariants: {\n    size: \"md\",\n    color: \"primary\",\n  },\n});\n\nbutton({ size: \"sm\", color: \"secondary\" });\n// => \"font-medium rounded-full active:opacity-80 bg-purple-500 text-white text-sm px-3 py-1\""
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "profile",
   "h2": "More about tailwind-variants",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "Packages around it",
       "items": [
        "tailwind-merge: Tailwind class conflict merger",
        "clsx: Conditional className builder",
        "tailwindcss: Utility-first CSS framework",
        "tw-animate-css: Tailwind animation utilities",
        "svelte: Compiled UI framework",
        "svelte-check: Svelte type and diagnostics checker"
       ]
      },
      {
       "title": "More in Styling and CSS",
       "path": "tools/styling/",
       "items": [
        {
         "text": "Tailwind CSS",
         "path": "tools/tailwindcss/"
        },
        {
         "text": "Emotion",
         "path": "tools/emotion/"
        },
        {
         "text": "Sass",
         "path": "tools/sass/"
        },
        {
         "text": "Fontsource Inter",
         "path": "tools/fontsource-variable-inter/"
        },
        {
         "text": "NativeWind",
         "path": "tools/nativewind/"
        },
        {
         "text": "postcss-import",
         "path": "tools/postcss-import/"
        },
        {
         "text": "Lightning CSS",
         "path": "tools/lightningcss/"
        },
        {
         "text": "mode-watcher",
         "path": "tools/mode-watcher/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "tailwind-variants",
       "me": true,
       "facts": [
        "MIT",
        "Gid 60",
        "7.4M/wk"
       ]
      },
      {
       "name": "Tailwind Merge",
       "why": "Merge Tailwind CSS classes intelligently without style conflicts.",
       "path": "tools/tailwind-merge/",
       "facts": [
        "MIT",
        "Gid 80",
        "118M/wk"
       ]
      }
     ],
     "more": "Compare tailwind-variants with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "install",
     "intro": "Install it.",
     "code": "npm install tailwind-variants"
    },
    {
     "t": "h3",
     "text": "Rules for your agent"
    },
    {
     "t": "rules",
     "label": "Paste into AGENTS.md or CLAUDE.md",
     "text": "## Tailwind Variants\n- Import from `tailwind-variants` when conflicting Tailwind classes must merge. Use `tailwind-variants/lite` only when merging is not needed.\n- On v3.3+, do not install `tailwind-merge` just for this library. Keep it only if the app imports it directly.\n- Use `cn` for everyday merging, `cx` in lite or when classes cannot conflict, and `cnMerge` when a call needs its own config.\n- Teach the resolver about custom utilities with `twMergeConfig` in `{ extend, override }` form. Never pass a merge function.\n- Define variants inline in `tv`, or mark external variant objects `as const`, so types are inferred.\n- On Tailwind v4, write breakpoint prefixes (`sm:`, `md:`) directly in class strings. There is no responsive variant API.\n- Give a recipe at most one `extend` parent. Add `slots: {}` only when you need slot functions.\n"
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "npm tailwind-variants"
  ],
  [
   "Category",
   "Styling and CSS"
  ],
  [
   "License",
   "MIT"
  ],
  [
   "Latest version",
   "v3.3.1, August 3, 2026"
  ],
  [
   "On GitHub since",
   "January 2023"
  ],
  [
   "Gid Score",
   "60.4"
  ],
  [
   "Rank in category",
   "#5 of 53"
  ],
  [
   "GitHub",
   "heroui-inc/tailwind-variants"
  ],
  [
   "Last change",
   "Nov 10, 2026"
  ]
 ],
 "good": [],
 "checked_line": "From the package registry, GitHub and our scan of public agent projects; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/heroui-inc.png"
}