Skip to content

jornatf/clnames

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.