This is @riverfl0w/clsxm
, a small, efficient utility that combines the functionality of clsx
and tailwind-merge
. It is designed for projects using Tailwind CSS, providing a streamlined way to handle conditional class names and optimize them for production.
- Efficient Class Name Merging: Seamlessly merge class names using
clsx
and optimize them usingtailwind-merge
. - Tailwind CSS Compatibility: Perfect for projects using Tailwind CSS.
- Simple API: Easy-to-use function that takes any number of class name arguments.
To install @riverfl0w/clsxm
, you can use npm or yarn:
npm install @riverfl0w/clsxm
# or
yarn add @riverfl0w/clsxm
Import clsxm
into your project and use it to concatenate and optimize class names:
import clsxm from '@riverfl0w/clsxm';
const buttonClass = clsxm(
'p-4',
'text-white',
{ 'bg-blue-500': !isError, 'bg-red-500': isError },
{ 'rounded-lg': isLarge },
);
- `...classes: (ClassValue[])`` - An array of class values (string, array, object, or null/undefined).
Returns a string of optimized class names.`
Contributions are welcome! If you'd like to contribute, please fork the repository and use a feature branch. Pull requests are warmly welcome.
- Mathieu Bour - mathieu@riverflow.co
- Valentin Pollart - valentin@riverflow.co
The code in this project is licensed under MIT license.