dcastil/tailwind-merge

Merge Tailwind CSS classes without style conflicts

TypeScript

5,693

1,746 commits

updated Oct 5, 2026

See the code

README

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.

PackageDescription
tailwind-merge (npm)The library itself — see the docs above.
@tailwind-merge/viteAutomatic theme configuration and source-based pruning for Vite apps. No stable release yet; dev builds on npm under the dev tag.
@tailwind-merge/nextThe same for Next.js apps, with Turbopack and webpack. No stable release yet; dev builds on npm under the dev tag.
@tailwind-merge/configuratorJavaScript API and CLI for generating a theme-specific merge module. Unreleased; API remains unstable.
@tailwind-merge/plugin-coreShared internals of the Vite and Next.js plugins (discovery, generation, refresh). Unpublished; inlined into both plugins.
css
tailwindcss
utility-classes

dcastil/tailwind-merge

Merge Tailwind CSS classes without style conflicts

TypeScript

5,693

1,746 commits

updated Oct 5, 2026

See the code

README

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.

PackageDescription
tailwind-merge (npm)The library itself — see the docs above.
@tailwind-merge/viteAutomatic theme configuration and source-based pruning for Vite apps. No stable release yet; dev builds on npm under the dev tag.
@tailwind-merge/nextThe same for Next.js apps, with Turbopack and webpack. No stable release yet; dev builds on npm under the dev tag.
@tailwind-merge/configuratorJavaScript API and CLI for generating a theme-specific merge module. Unreleased; API remains unstable.
@tailwind-merge/plugin-coreShared internals of the Vite and Next.js plugins (discovery, generation, refresh). Unpublished; inlined into both plugins.
css
tailwindcss
utility-classes

Significant stargazers

(top 24 of 51)

Manoel Aranda Neto

220 followers · starred Sep 2026

Serge Aleynikov

281 followers · starred Feb 2023

3w36zj6

153 followers · starred Jul 2025

christopherkindl

98 followers · starred Feb 2023