Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

classnames

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

classnames

A simple utility for conditionally joining classNames together

  • 2.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11M
decreased by-14.44%
Maintainers
1
Weekly downloads
 
Created

What is classnames?

The classnames package is a simple utility for conditionally joining class names together. It is commonly used in React projects but can be used anywhere that requires dynamic class name computation.

What are classnames's main functionalities?

String arguments

Combine multiple string arguments into one class name.

classnames('foo', 'bar'); // 'foo bar'

Object arguments

Use an object to include class names conditionally based on the truthiness of the object's values.

classnames({ 'foo': true, 'bar': false }); // 'foo'

Array arguments

Pass an array of class names which will be joined together.

classnames(['foo', 'bar']); // 'foo bar'

Mixed arguments

Combine string, object, and array arguments to form a class name string.

classnames('foo', { 'bar': true, 'duck': false }, ['baz', { 'quux': true }]); // 'foo bar baz quux'

Other packages similar to classnames

Keywords

FAQs

Package last updated on 26 Nov 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc