Skip to content

cn

Size
0.09 kb
View source

className utility that removes false | null | undefined | 0 from the output string.

import { cn } from 'crustack/utils'
const MyComponent = ({ className, isOpen }: Props) => (
<div
className={cn(
className, // removes undefined className
isOpen && 'bg-gray-200', // removes falsy values
'flex items-center',
)}
>
...
</div>
)