Browse by type
<a href="https://github.com/dcastil/tailwind-merge">
<img src="https://github.com/dcastil/tailwind-merge/raw/tailwind-merge@3.7.0/packages/tailwind-merge/assets/logo.svg" alt="tailwind-merge" height="150px" />
</a>
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]'
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. Unreleased. |
| @tailwind-merge/configurator | JavaScript API and CLI for generating a theme-specific merge module. Unreleased; API remains unstable. |
browse all types & interfaces →
$ claude mcp add tailwind-merge \
-- python -m otcore.mcp_server <graph>