1.0.0 • Published 1 year ago
@scriptum/classis v1.0.0
Classis: utility to construct html classes conditionally
⚠️ I recommend using classnames since they are legacy compatible and take serious action about compatibility, and clsx are much faster.
Why classis exists?
classnames are good but it doesn't override classes which is what i want.
Examples
import classis from 'classis';
classis("blue", { blue: false }) // -> ''
classis("blue", ['btn', ['rouned']] { blue: 'red' }) // -> 'btn rouned red'
// With tailwindcss
classis("bg-red-500", { 'bg-red-500': 'bg-blue-500' }) // -> 'bg-blue-500'
More examples in tests
1.0.0
1 year ago