clnames
v1.0.2
Published
Concat conditional classnames in your JavaScript project.
Downloads
3
Maintainers
Readme
clnames
clnames is a NPM Package to concat simple and conditional classnames in your JavaScript project.
Installation
# In your terminal, enter command:
npm install clnames
Usage
import clnames from "clnames";
clnames(...classes);
Arguments classes
must be a string
or an object
.
See example with React, below:
import { useState } from "react";
import clnames from "clnames";
const App = () => {
const [color, setColor] = useState("blue");
//...
return (
<div className="App">
<div
className={clnames(
"font-bold",
{
"text-blue-500": color === "blue",
"text-red-300": color === "red",
} /*...*/
)}
>
Hello, I'm {color}
</div>
</div>
);
};
export default App;
Contributing
If you are interested in this project and want to improve it, fix errors or bugs, you're welcome to contribute.
Credits
Licence
The MIT License (MIT).
[!Note] Please see License File for more information.