
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
tailwind-classify
Advanced tools
A lightweight utility function to merge and conditionally join class names.
A lightweight utility function to merge and conditionally join class names in JavaScript/TypeScript, built on top of clsx and tailwind-merge for optimal CSS class management.
You can install the package via npm:
npm install tailwind-classify
Alternatively, you can install it using yarn:
yarn add tailwind-classify
The classify function allows you to conditionally combine strings, objects, and arrays of class names. It uses clsx for merging classes and tailwind-merge to handle duplicate Tailwind CSS classes correctly.
Examples:
import { classify } from 'tailwind-classify';
// Basic usage
const buttonClass = classify('btn', 'btn-primary');
// Result: 'btn btn-primary'
// Handling falsy values
const buttonClass = classify('btn', false, 'btn-primary', undefined);
// Result: 'btn btn-primary' (falsy values are ignored)
// Conditional classes
const isActive = true;
const buttonClass = classify('btn', isActive && 'active');
// Result: 'btn active'
// Handling null values
const buttonClass = classify('btn', null, 'btn-primary');
// Result: 'btn btn-primary'
// Tailwind CSS class merging (removes duplicates)
const buttonClass = classify('p-4', 'bg-red-500', 'p-4');
// Result: 'p-4 bg-red-500'
classify(...inputs: (string | boolean | undefined | null)[]): string
Features:
import { classify } from 'tailwind-classify';
const classString = classify('p-4', 'bg-blue-500', 'p-4', 'text-white');
// Result: 'p-4 bg-blue-500 text-white' (duplicates removed)
This package is completely free to use and is open-source under the MIT License. You can use, modify, and distribute it however you like.
FAQs
A lightweight utility function to merge and conditionally join class names.
The npm package tailwind-classify receives a total of 156 weekly downloads. As such, tailwind-classify popularity was classified as not popular.
We found that tailwind-classify demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.