class-variance-authority
0.7.1 · 26 Nov 2024Apache-2.087.5M / weekRepositoryHomepagenpmAtom feed
18 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
- 0.7.x · latest line
0.7.1
26 Nov 2024Add LICENSE Comments
What's Changed
Add LICENSE Comments
0.7.0
17 Jul 2023Upgrade to
clsx@2.0.0
- 0.6.x
0.6.1
26 Jun 2023Add missing
licensekey inpackage.jsonUpgrade to
typescript@5.1.3
0.6.0
27 Apr 2023cx→clsxcvanow usesclsxunder-the-hood to concatenate classes with no breaking changes to the current experience and no increase to bundle-size.The existing
cxexport still exists, but as an alias ofclsxBringing additional benefits of:
- 0.5.x
0.5.3
26 Apr 2023Added explicit undefined type to support exactOptionalPropertyTypes option
This has been a long standing issue for me and I'm so grateful to @totto2727 for making the fix
0.5.2
11 Apr 2023Support for
moduleResolution: bundler(addtypestoexportsfield inpackage.json)
0.5.1
2 Apr 2023Support for TypeScript 5
What's Changed
Warning
v0.5.0is broken, please skip straight tov0.5.1Support for TypeScript 5
Support the Project
Note
I'm actually supposed to be on vacation right now, but it seems like people are desperate for TypeScript 5 supportcva is a labour of love – I don't get paid to work on this project
Contributions of any size are greatly appreciated 🙏🏼
Ethereum
0xC756F748ff6A499f3C826529A0Da30FF1A3ac28c
image
0.5.0
2 Apr 2023- 0.4.x
0.4.0
5 Dec 2022Target 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: "…", }, ], });Readme example
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
- 0.3.x
0.3.0
7 Nov 2022Add Support for the
classNamePropReact.js friends, you can be at peace: you can now use the
classNameor theclassprop.
- 0.2.x
0.2.4
14 Oct 2022Fix variant key
0use-case
0.2.3
15 Jul 2022Remove
classprop fromVariantProps
0.2.2
12 Jun 2022- Breaking
Support for Typescript 4.7 (non-breaking change)
0.2.1
6 Apr 2022Support Compiling TypeScript with
--declarationFlag
0.2.0
5 Apr 2022Improved/corrected support for
booleanvariants; both as a prop anddefaultVariantdefaultVariantsstyles can now be disabled/removed completely by setting the relevant variant asnullconst 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"Advise aliasing during install instead of TS Paths
Fixes
Improved/corrected support for
booleanvariants; both as a prop anddefaultVariant
Features
defaultVariantsstyles can now be disabled/removed completely by setting the relevant variant asnullconst 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
- 0.1.x
0.1.0
13 Feb 2022Adds support for boolean variants (huge thanks to @mariusflorescu) 🚀
- 0.0.x
0.0.1
9 Feb 2022Initial release 🚀
0.0.0
26 Jan 2022
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.