conditional-class
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

conditional-class NPM version NPM monthly downloads NPM total downloads Build Status

adds your conditional classnames to the base classname

Please follow me and consider starring the project to show your ❤️ and support.

Install

Install with npm:

$ npm install --save conditional-class

Usage

Works with strings or numbers.

import { conditionalClass } from 'conditional-class';

console.log(condionalClass('some-class')); //=> some-class
console.log(condionalClass('some-class', { 'is-active': true })); //=> some-class is-active
console.log(condionalClass(undefined, { 'is-active': true })); //=> is-active
console.log(condionalClass(['class'], { 'is-active': true })); //=> class is-active

License

Copyright © 2021, Hossein Dindar. Released under the MIT License.

Package Sidebar

Install

npm i conditional-class

Weekly Downloads

8

Version

1.2.0

License

MIT

Unpacked Size

6.96 kB

Total Files

11

Last publish

Collaborators

  • hosseindindar