Skip to content
/ cntw Public

A simple JavaScript utility for conditionally joining Tailwind CSS classes together.

License

Notifications You must be signed in to change notification settings

sshkeda/cntw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cntw (classnames + tailwind-merge)

A simple JavaScript utility for conditionally joining Tailwind CSS classes together.

Installation

pnpm add cntw

Usage

import { cn } from "cntw";

export default function ButtonExample() {
  const disabled = true;

  return (
    <button
      className={cn(
        "rounded-md bg-green-500 px-4 py-2 font-bold text-white",
        disabled && "bg-red-500"
      )}
    >
      Click me
    </button>
  );
}