Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
T

tailwind-merge

> 前端框架
Open source

Merge Tailwind CSS classes without style conflicts

5.7K stars0 likes0 views
WebsiteGitHub

About

Merge Tailwind CSS classes without style conflicts

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]'
  • Supports Tailwind v4.0 up to v4.3 (if you use Tailwind v3, use tailwind-merge v2.6.0)
  • Works in all modern browsers and maintained Node versions
  • Fully typed, with published declarations compatible with TypeScript 3.8 and newer
  • Check bundle size on Bundlephobia

Get started

  • What is it for
  • When and how to use it
  • Features
  • Limitations
  • Configuration
  • Recipes
  • API reference
  • Writing plugins
  • Versioning
  • Contributing
  • Similar packages

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.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScriptcsstailwindcssutility-classes

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category前端框架
PricingOpen source

> Related tools

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架