</>PackageGraphPackageGraph

clsx

npmv2.1.1TypeScript

A tiny (239B) utility for constructing className strings conditionally.

Adopt with care

clsx is usable, with caveats. Last published 870 days ago.

  • ?Adoption: grade ?, Not reported by this registry.

    No download data reported for this package yet.

  • DMaintenance: grade D, Poor — a real concern.

    Last published 870 days ago.

  • AWeight: grade A, Excellent.

    Zero runtime dependencies, about 8.4 KB installed.

  • BSupply chain: grade B, Good.

    This package has a single maintainer (bus factor of 1).

  • ALicense: grade A, Excellent.

    MIT — permissive, with no copyleft found in the dependency tree.

Grades are computed deterministically from registry metadata collected by PackageGraph — downloads, dependents, publish dates, the resolved dependency tree, maintainer count, and declared licenses. No third-party scores are used.

Install cost

What you actually take on by adding clsx to a project.

0
Direct dependencies

Runtime packages this one declares itself.

0
Total installed

Distinct packages in the full runtime tree, deduplicated the way a package manager would.

8.4 KB
Install size

Unpacked size of this package plus its entire runtime tree.

Tree depth

Longest resolved dependency chain below this package.

Compatibility

Node.js
node >=6
Module format
ESM + CommonJS
TypeScript
Types included
Install scripts
None

Quick start

A usage example from the clsx README.

import clsx from 'clsx';
// or
import { clsx } from 'clsx';

// Strings (variadic)
clsx('foo', true && 'bar', 'baz');
//=> 'foo bar baz'

// Objects
clsx({ foo:true, bar:false, baz:isTrue() });
//=> 'foo baz'

// Objects (variadic)
clsx({ foo:true }, { bar:false }, null, { '--foobar':'hello' });
Example truncated — see the full README.

Dependencies

Declared by clsx v2.1.1. Runtime dependencies are installed with the package; dev dependencies are not.

Dev (3)

esm 3.2.25terser 4.8.0uvu 0.5.4

Used by

Popular packages that depend on clsx.

Relationship graph

Dependencies (left) and dependents (right) of clsx.

sveltejest-environment-…clsx
clsx dependencies dependents

Frequently installed together

Release history

No releases in the last two years, typically about 47 days apart.

Recent versions of clsx
VersionPublishedSizeLicense
2.1.1latest2 years ago8.4 KBMIT
2.1.02 years ago8.3 KBMIT
2.0.12 years ago6.8 KBMIT
2.0.03 years ago6.6 KBMIT
2.0.0-next.03 years ago6.6 KBMIT
1.2.14 years ago5.5 KBMIT
1.2.04 years ago6.1 KBMIT
1.1.16 years ago6.1 KBMIT
1.1.06 years ago6.0 KBMIT
1.0.47 years ago5.6 KBMIT
1.0.37 years ago5.2 KBMIT
1.0.27 years ago5.2 KBMIT
1.0.17 years ago5.2 KBMIT
1.0.07 years ago5.0 KBMIT
0.0.17 years ago4.9 KBMIT

Overview

clsx is an npm package that a tiny (239B) utility for constructing className strings conditionally. It has 2 known dependents in the graph. The latest version is 2.1.1, released under the MIT license.

Who should use it

Teams working in the npm ecosystem who need a tiny (239B) utility for constructing className strings conditionally and value a focused solution.

When not to use it

Consider an alternative if you need to or if a more actively-maintained option better fits your npm stack.

Pros

  • Ships TypeScript type definitions.
  • Clear open-source license (MIT).
  • Lean dependency tree (3 direct dependencies).

Cons

  • No significant drawbacks detected from available metadata.

Auto-generated from collected registry metadata. No external claims are inferred.

Maintainers

Keywords

Frequently asked questions

Should I use clsx?

clsx is usable, with caveats. Last published 870 days ago.

How do I install clsx?

Run `npm install clsx` to add clsx to your npm project.

What license is clsx released under?

clsx is distributed under the MIT license.

How popular is clsx?

npm does not publish download counts. Within PackageGraph's crawl, 2 known packages depend on clsx.

Is clsx still maintained?

The most recent release of clsx (v2.1.1) was published 2 years ago.

Does clsx run install scripts?

No. clsx does not define preinstall, install, or postinstall scripts, so installing it does not execute publisher-supplied code.