Packages

class-variance-authority

0.7.1 · 26 Nov 2024Apache-2.087.5M / weekRepositoryHomepagenpmAtom feed

Your version

0.6.0

27 Apr 2023Where it was published

0.7.1 is the newest release of 0.6.x.

In short

2 changed

Release note

What's Changed

  • cx → clsx

    cva now uses clsx under-the-hood to concatenate classes with no breaking changes to the current experience and no increase to bundle-size.

    The existing cx export still exists, but as an alias of clsx

    Bringing additional benefits of:

    1. Provides additional support for booleans and variadic strings within class or className props

      const button = cva([true && "button-base", false && "not-rendered"]);
      // => 'button-base'
      
      const buttonConsumer = button({ class: [true && "extra-class"] });
      // => 'button-base extra-class'
    2. Provides support for object syntax within class or className props

      const button = cva({ foo: true, bar: false });
      // => 'foo baz'

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.