Packages

class-variance-authority

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

Your version

0.2.0

5 Apr 2022Where it was published

0.7.1 is the newest release of 0.2.x.

In short

2 new3 fixed1 changed2 internal

Release note

Fixes

  • Improved/corrected support for boolean variants; both as a prop and defaultVariant

Features

  • defaultVariants styles can now be disabled/removed completely by setting the relevant variant as null

    const button = cva("button", {
     variants: {
       disabled: { false: "button--enabled", true: "button--enabled" },
     },
     defaultVariants: {
       disabled: false,
     },
    });
    
    const buttonWithDefault = button();
    // "button button--enabled"
    
    const buttonWithoutDefault = button({ disabled: null });
    // "button"
    
    

Pull Requests

  • Advise aliasing during install instead of TS Paths

  • Allow both boolean states for boolean variant

  • Add missing word to README

  • Fix Behaviour of Falsey Boolean Variants

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.