dangapp-cva-factory

Build reusable UI primitives with class-variance-authority and a shared cn() merge path.

Updated Feb 28, 2026
One-click install
npx skills add https://github.com/kimjuyoung1127/dangapp --skill dangapp-cva-factory
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dangapp-cva-factory
Source: https://github.com/kimjuyoung1127/dangapp/tree/main/.claude/skills/dangapp-cva-factory
Command: npx skills add https://github.com/kimjuyoung1127/dangapp --skill dangapp-cva-factory

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill streamlines the creation of reusable UI components by abstracting complex class logic into manageable variants, preventing ad-hoc branching and ensuring a consistent styling API.

Core Features & Use Cases

  • Variant-Driven Components: Define UI primitives with class-variance-authority for clear size, intent, state, or radius variations.
  • Unified Class Merging: Integrates external className props seamlessly using a shared cn() utility.
  • Use Case: Refactor a button component that currently uses many if/else statements for different sizes and colors into a single component with semantic variants like size="small" and color="primary".

Quick Start

Create a new reusable UI primitive using class-variance-authority and a shared cn() merge path.

Frequently Asked Questions about dangapp-cva-factory

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor React components with complex if/else styling logic into semantic variants?▼

You can refactor React components by replacing ad-hoc if/else branching with class-variance-authority to define semantic variants like size or color. This approach abstracts complex class logic into a manageable API, ensuring deterministic styling for UI primitives.

What is the best way to manage CSS variations for reusable UI primitives?▼

Managing CSS variations for reusable UI primitives is best done using class-variance-authority alongside a shared cn() merge utility. This setup handles semantic variant definitions and seamlessly merges external className props for consistent frontend styling.

How does class-variance-authority work with external className props in React?▼

Class-variance-authority integrates external className props through a shared cn() utility path. This unified merge path ensures external styles combine seamlessly with predefined variants, preventing styling conflicts and maintaining a consistent component API.

Can I use this approach to create new UI elements with stable APIs for size and state?▼

Yes, you can create new UI elements with stable APIs for size, tone, or state using class-variance-authority. It applies to building new UI primitives by establishing deterministic class logic and semantic variant naming from the start.

When should I use class-variance-authority for frontend component styling?▼

Use class-variance-authority for frontend component styling when you need to prevent ad-hoc branching and ensure a consistent styling API. It is ideal for defining UI primitives with clear size, intent, state, or radius variations.