Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tailwind-merge

Package Overview
Dependencies
Maintainers
1
Versions
291
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tailwind-merge

Merge Tailwind CSS classes without style conflicts

  • 2.2.1-dev.41117c80c51a6ed6859834f5f963147b163a6ec5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.4M
decreased by-9.64%
Maintainers
1
Weekly downloads
 
Created

What is tailwind-merge?

The tailwind-merge npm package is a utility for combining and deduplicating Tailwind CSS classes. It helps developers to programmatically merge class strings while avoiding conflicts and redundancies, ensuring the final class string is optimized for use.

What are tailwind-merge's main functionalities?

Merging Tailwind CSS classes

This feature allows you to merge multiple class strings into one, automatically resolving conflicts by using the last occurrence of a conflicting class.

"twMerge('p-4 font-bold', 'p-2 text-center') // 'p-2 font-bold text-center'"

Removing Tailwind CSS classes

This feature enables you to remove specific classes from a string by prefixing the class with a minus sign.

"twMerge('p-4 font-bold', '-p-4') // 'font-bold'"

Handling arbitrary values

Tailwind-merge can handle arbitrary values in class names, allowing you to merge classes with custom values effectively.

"twMerge('p-[30px]', 'p-4') // 'p-4'"

Handling variants and groups

The package can also manage Tailwind's variants and groups, ensuring that the correct specificity is maintained when merging classes with variants.

"twMerge('hover:bg-black', 'hover:bg-white') // 'hover:bg-white'"

Other packages similar to tailwind-merge

Keywords

FAQs

Package last updated on 03 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc