Back to Explore

lukeed/clsx

GitHub
1 watchersOpen source

Last release:

clsx is a tiny JavaScript utility for building `className` strings conditionally from strings, arrays, and objects. It discards falsey values and can be used as a faster, smaller drop-in replacement for the `classnames` module, with builds available in ES Module, CommonJS, and UMD formats.

Project status

  • Maintenance status: The repository appears quiet/dormant now, with the last upstream push on 2024-06-10 and the most recent published updates listed in 2024-04-23, which is roughly two years ago relative to 2026-06-11.
  • Update cadence: Earlier updates show bursts (notably 2023-12-29 multiple updates, plus 2024-04-23), but there has been no evident recent update cadence after mid-2024.

AI summary generated

AI-generated from public sources. May be inaccurate. Report

Recent updates

  • v2.1.1

    v2.1.1 is a patch release that updates the TypeScript typings for clsx to accept `bigint` as a valid `ClassValue`. It also adds a `licenses.dev` badge to the README and increments the package version.

    Features
  • v2.1.0

    v2.1.0 introduces a new submodule, `clsx/lite`, intended for string-only class name composition by ignoring non-string arguments. The change also extends the build and package export configuration so the published package exposes separate entrypoints for `clsx` and `clsx/lite`.

    Features
  • v2.0.1

    v2.0.1 is primarily a performance patch, plus routine CI and documentation/benchmark updates. The only functional code change in src appears to be loop optimizations to cache lengths, aligning with the release note performance claim.

  • v2.0.0

    v2.0.0 introduces native ESM support via a new `exports` map and updates TypeScript definitions to better support `node16`/`nodenext` module resolution. The release also adds README documentation for Tailwind CSS integration and expands test coverage for number inputs.

    BreakingFeatures
  • v1.2.1

    v1.2.1 updates how the package builds and publishes its CJS and UMD entrypoints. The release notes mention adding a named `clsx` export to CommonJS and UMD, and that CJS/UMD are built manually instead of via the previous tool.

  • v1.2.0

    v1.2.0 introduces a named export for the main `clsx` utility so TypeScript users can write `import { clsx } from 'clsx'`. The release also modernizes the test and CI setup by migrating from `tape` to `uvu` and expanding the Node test matrix.

    Features
  • v1.1.1

    v1.1.1 is a performance-focused patch for `clsx`, with several micro-optimizations around how inputs are converted and concatenated. The release notes emphasize faster execution and slightly smaller bundle size, plus CI/test tooling updates.

  • v1.1.0

    v1.1.0 updates clsx's array detection logic to use Array.isArray instead of checking for a truthy push property. This fixes incorrect handling of objects that define a truthy push key, and the release also notes a resulting browser support change for IE8 and older.

    Breaking
  • v1.0.4

    v1.0.4 focuses on performance and behavior tweaks inside the core `clsx` value normalization. The release notes highlight ignoring function arguments and optimizing array iteration, plus adding/updating benchmark documentation.

    Breaking
  • v1.0.3

    v1.0.3 updates the npm package metadata to point bundlers to a different ESM build filename via the package.json "module" field. The only code-diff change is a rename of the "module" entry from the old .mjs file to the new .m.js file.