Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jornatf/clnames

Concat conditional classnames in your JavaScript project.
https://github.com/jornatf/clnames

classnames helpers javascript nodejs npm npm-package package react

Last synced: about 2 months ago
JSON representation

Concat conditional classnames in your JavaScript project.

Awesome Lists containing this project

README

        

# clnames

![Latest Version](https://img.shields.io/github/v/tag/jornatf/clnames?label=version&style=flat-square)
[![Licence](https://img.shields.io/github/license/jornatf/clnames?label=license&style=flat-square)](LICENCE.md)
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/jornatf/clnames/run-tests.yml?branch=master&label=test&style=flat-square)](https://github.com/jornatf/clnames/actions?query=workflow%3Arun-tests+branch%3Amaster)
[![Downloads](https://img.shields.io/npm/dt/clnames?label=downloads&style=flat-square)](https://www.npmjs.com/package/clnames)

**clnames** is a [NPM Package](https://www.npmjs.com/package/clnames) to concat simple and conditional classnames in your JavaScript project.

## Installation

```bash
# In your terminal, enter command:
npm install clnames
```

### Usage

```javascript
import clnames from "clnames";

clnames(...classes);
```

Arguments `classes` must be a `string` or an `object`.

See example with [React](https://react.dev/), below:

```javascript
import { useState } from "react";
import clnames from "clnames";

const App = () => {
const [color, setColor] = useState("blue");

//...

return (



Hello, I'm {color}


);
};

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

- [Jordan Nataf](https://github.com/jornatf)
- [All Contributors](../../contributors)

## Licence

The MIT License (MIT).

> [!Note]
> Please see [License File](LICENSE.md) for more information.