1.0.4 • Published 3 years ago

classnamesx v1.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

This package serves as an simple alternate to the popular classnames package, written in just 10 lines of (es6) javascript.

Example usage:

import classNames from "classnamesx";

classNames("foo", "bar"); // "foo bar"
classNames(["foo", "bar"]); // "foo bar"
classNames("foo", { bar: true }); // "foo bar"
classNames({ foo: true }, { bar: true }); // "foo bar"
classNames({ foo: true, bar: true }); // "foo bar"
classNames({ foo: true, bar: true, baz: false }); // "foo bar"
classNames({ foo: true }, ["bar", { baz: true }]); // "foo bar baz"

// in a React app...
export default function MyComponent({ isActive }) {
  return <div className={classNames({ active: isActive })}>Hello, world!</div>;
}
1.0.2

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago