MCPcopy Create free account
hub / github.com/dcastil/tailwind-merge

github.com/dcastil/tailwind-merge

Chat with this repo
repository ↗ · DeepWiki ↗ · release tailwind-merge@3.7.1 ↗ · + Follow · compare 4 versions
550 symbols 1,800 edges 193 files 137 documented · 25% ● updated 1d agov2.6.2 · 2026-11-18★ 5,70617 open issues

Browse by type

⨍ Functions 489◇ Types & classes 61
What it actually does AI analysis from the code graph — generated when you open this
loading…
README
<a href="https://github.com/dcastil/tailwind-merge">
    <img src="https://github.com/dcastil/tailwind-merge/raw/tailwind-merge@3.7.1/packages/tailwind-merge/assets/logo.svg" alt="tailwind-merge" height="150px" />
</a>

tailwind-merge

Utility function to efficiently merge Tailwind CSS classes in JS without style conflicts.

import { twMerge } from 'tailwind-merge'

twMerge('px-2 py-1 bg-red hover:bg-dark-red', 'p-3 bg-[#B91C1C]')
// → 'hover:bg-dark-red p-3 bg-[#B91C1C]'

Get started

Packages in this repository

This repository is a monorepo. The docs above belong to the tailwind-merge package — what most visitors are here for — and everything package-specific (source, docs, changelog) lives in the package directories.

Package Description
tailwind-merge (npm) The library itself — see the docs above.
@tailwind-merge/vite Automatic theme configuration and source-based pruning for Vite apps. No stable release yet; dev builds on npm under the dev tag.
@tailwind-merge/next The same for Next.js apps, with Turbopack and webpack. No stable release yet; dev builds on npm under the dev tag.
@tailwind-merge/configurator JavaScript API and CLI for generating a theme-specific merge module. Unreleased; API remains unstable.
@tailwind-merge/plugin-core Shared internals of the Vite and Next.js plugins (discovery, generation, refresh). Unpublished; inlined into both plugins.

Extension points exported contracts — how you extend this code

browse all types & interfaces →

Core symbols most depended-on inside this repo

browse all functions →

Shape

Function 470
Interface 61
Method 19

Languages

TypeScript100%

Modules by API surface

packages/tailwind-merge/src/lib/validators.ts43 symbols
packages/tailwind-merge/src/lib/default-config.ts33 symbols
packages/vite/src/index.ts23 symbols
packages/configurator/src/emit.ts23 symbols
packages/next/tests/helpers.ts21 symbols
packages/configurator/src/plan.ts20 symbols
packages/configurator/src/design-system.ts20 symbols
packages/configurator/tests/fixture-utils.ts19 symbols
packages/tailwind-merge/src/lib/class-group-utils.ts18 symbols
packages/configurator/src/custom-utilities.ts18 symbols
packages/plugin-core/src/generation.ts15 symbols
packages/vite/tests/helpers.ts14 symbols

Dependencies from manifests, versioned

@babel/core8.1.0 · 1×
@babel/preset-env8.0.7 · 1×
@codspeed/vitest-plugin5.7.1 · 1×
@rollup/plugin-babel7.1.0 · 1×
@rollup/plugin-node-resolve16.0.3 · 1×
@tailwind-merge/plugin-coreworkspace:* · 1×
@tailwindcss/node4.3.5 · 1×
@tailwindcss/oxide4.3.5 · 1×
@tailwindcss/vite4.3.5 · 1×

For agents

$ claude mcp add tailwind-merge \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page