Conditionally join CSS class names together - Especially useful with React
class-names but support array input
Inspired byInstall
$ npm install rockclass
Usage
;//=> 'unicorn rainbow' ;//=> 'unicorn rainbow' ;//=> 'awesome unicorn' ;//=> 'unicorn' const buttonType = 'main';;//=> 'button-main'
const Button = { console; /* { type: 'success', small: true } */ const buttonClass = ; console; //=> 'button button-success button-small' return <button =>…</button>;};
API
rockClass(…input)
Conditionally join CSS class names together.
input
Type: string
Object
Array
Accepts a combination of strings objects and Array. Only object keys with truthy values are included. Anything else is ignored.
FAQ
class-names
?
How is it different from - support array input.
Related
- react-extras - Useful components and utilities for working with React
- class-names - Conditionally join CSS class names together - Especially useful with React
License
MIT © hkc