1.3.1 • Published 2 years ago
@infotition/classnames v1.3.1
Getting started
The classNames
function takes any number of argument which can be strings or booleans. Any given boolean gets ignored while the strings are combined with an empty space as separator. This allows conditional shortcuts like isAdmin && 'admin'
without cluttering the class names with false string values if the expression evaluates to false.
import { classNames } from '@infotition/classnames';
classNames('foo', 'bar', 'infotition'); // => 'foo bar infotition'
classNames(6 > 5 && 'foo', 'infotition', 5 > 6 && 'bar'); // => 'foo bar'
Docs
Read full docs on GitHub.