Skip to content

Latest commit

 

History

History
72 lines (51 loc) · 1.8 KB

README.md

File metadata and controls

72 lines (51 loc) · 1.8 KB

clnames

Latest Version Licence GitHub Tests Action Status Downloads

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.