npm class-variance-authority 0.4.0
v0.4.0

latest releases: 0.7.1, 0.7.1-canary.2, 0.7.1-canary.1...
2 years ago

What's Changed

Features

  • Target Multiple Variant Options within Compound Variants by @joe-bell and @JeroenReumkens in #76

    // 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

New Contributors

Full Changelog: v0.3.0...v0.4.0

Don't miss a new class-variance-authority release

NewReleases is sending notifications on new releases.