Skip to content

Instantly share code, notes, and snippets.

@jrobinsonc
Last active July 13, 2025 19:41
Show Gist options
  • Save jrobinsonc/3690e5b835a09d27801338bf786a4bae to your computer and use it in GitHub Desktop.
Save jrobinsonc/3690e5b835a09d27801338bf786a4bae to your computer and use it in GitHub Desktop.
Merge Tailwind CSS classes efficiently.
import { clsx, type ClassValue } from 'clsx';
import { twMerge } from 'tailwind-merge';
/**
* Merge Tailwind CSS classes efficiently.
*
* @param inputs - Class values to merge.
* @returns Merged class names.
*/
export function cn(...inputs: ClassValue[]): string {
return twMerge(clsx(inputs));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment