jedwatson/classnames

A simple javascript utility for conditionally joining classNames together

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 24 minutes ago
Added to GitGenius on September 3rd, 2026
Created on November 5th, 2014
Open Issues & Pull Requests: 12 (+0)
GitHub issues: Enabled
Number of forks: 560
Total Stargazers: 17,780 (+0)
Total Subscribers: 120 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 26.8 hours
Mean response time: 39.7 days
90th percentile: 145.9 days
Tracked items: 6

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 1
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 866 days
Stale 30+ days: 1
Stale 90+ days: 1

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

  • question (2)

Most active issues this week

No issue events were indexed in the last 7 days.

Detailed Description

Classnames is a JavaScript utility for conditionally joining classNames together.

The tool solves the problem of dynamically constructing CSS class strings in JavaScript applications, particularly when class inclusion depends on runtime conditions. It accepts any number of arguments—strings, objects, or arrays—and filters them based on truthiness. String arguments are treated as class names to include, while object arguments use their keys as class names, including only those whose values are truthy. Arrays are recursively flattened according to the same rules, allowing for flexible composition of class names at any nesting level.

Developers building React applications or any JavaScript project with conditional styling should consider this utility. It is especially valuable when managing multiple conditional classes that would otherwise require string concatenation or ternary operators, making code more readable and maintainable. The tool works in Node.js environments, browsers via Browserify or webpack, and can be included as a standalone script tag for direct browser use.

The project prioritizes stability and performance, with updates thoroughly reviewed for performance implications before release and backed by a comprehensive test suite. Issue tracker activity is dominated by user questions, indicating active community engagement with the tool.