css-variants is no longer maintained. Use @lynstack/class-recipe: faster, stricter types, and React Native support. Migrate →
No longer maintained. Migrate to class-recipe →
css-variants is no longer maintained. Use @lynstack/class-recipe: faster, stricter types, and React Native support. Migrate →
No longer maintained. Migrate to class-recipe →
Run one of the following commands to install css-variants:
npm install css-variantspnpm add css-variantsyarn add css-variantscss-variants ships with dual ESM and CommonJS builds:
// ESMimport { cv, scv, sv, ssv, cx } from 'css-variants'
// CommonJSconst { cv, scv, sv, ssv, cx } = require('css-variants')The package exports five functions:
| Export | Description |
|---|---|
cv | Class variants for single-element components |
scv | Slot class variants for multi-element components |
sv | Style variants for inline CSS styles |
ssv | Slot style variants for multi-element inline styles |
cx | Class name merger utility (like clsx) |
Create your first variant with the Quick Start guide.