onmyway133 / blog

🍁 What you don't know is what you haven't learned
https://onmyway133.com/
MIT License
669 stars 33 forks source link

How to dynamically build tailwind class names #950

Open onmyway133 opened 8 months ago

onmyway133 commented 8 months ago

Inspired by shadcn

Combine

import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"

export function cn(...inputs: ClassValue[]) {
    return twMerge(clsx(inputs))
}