New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More ā†’
Socket
Sign inDemoInstall
Socket

cva-extended

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cva-extended

Class Variance Authority šŸ§¬ - Extended

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
50
decreased by-37.5%
Maintainers
0
Weekly downloads
Ā 
Created
Source

cva-extended

An extended version of cva, with additional features:

For the main documentation, visit beta.cva.style.

Extended Features

variants object exposed on a cva component

const button = cva({
  variants: {
    intent: {
      primary: "bg-blue-500",
      secondary: "bg-white",
    },
    disabled: {
      true: "opacity-50",
      false: "opacity-100",
    },
  },
});

button.variants; // { intent: ["primary", "secondary"], disabled: [true, false] }
typeof button.variants;
//            ^?
//            {
//              "intent": ReadonlyArray<'primary' | 'secondary'>,
//              "disabled": readonly boolean[]
//            }
//

Require variants, unless a default is provided in defaultVariants

const button = cva({
  variants: {
    intent: {
      primary: "bg-blue-500",
      secondary: "bg-white",
    },
  },
});

button(); // Error: Missing required variant: intent

const optionalIntent = cva({
  variants: {
    intent: {
      primary: "bg-blue-500",
      secondary: "bg-white",
    },
  },
  defaultVariants: {
    intent: "primary",
  },
});

optionalIntent(); // No error

Private variants

const button = cva({
  variants: {
    intent: {
      primary: "bg-blue-500",
      secondary: "bg-white",
    },
    $private: {
      true: "private",
    },
  },
});

button({ $private: true }); // Error: Variant $private is not exposed
button.variants; // { intent: ["primary", "secondary"] }
typeof button.variants;
//            ^?
//            {
//              "intent": ReadonlyArray<'primary' | 'secondary'>
//            }
//

Keywords

FAQs

Package last updated on 23 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with āš”ļø by Socket Inc