Packages

class-variance-authority

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

Your version

0.4.0

5 Dec 2022Where it was published

0.7.1 is the newest release of 0.4.x.

In short

1 new1 fixed1 internal

Release note

What's Changed

Features

  • Target Multiple Variant Options within Compound Variants

    // components/button.ts
    import { cva } from "class-variance-authority";
    
    const button = cva("…", {
      variants: {
        intent: { primary: "…", secondary: "…" },
        size: { small: "…", medium: "…" },
      },
      compoundVariants: [
        // Applied via:
        //   `button({ intent: "primary", size: "medium" })`
        //     or
        //   `button({ intent: "secondary", size: "medium" })`
        {
          intent: ["primary", "secondary"],
          size: "medium",
          class: "…",
        },
      ],
    });

Chores

  • Readme example

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.