component-variants

📁 fusengine/agents 📅 Today
3
总安装量
1
周安装量
#55242
全站排名
安装命令
npx skills add https://github.com/fusengine/agents --skill component-variants

Agent 安装分布

amp 1
cline 1
opencode 1
cursor 1
continue 1
kimi-cli 1

Skill 文档

Component Variants

Agent Workflow (MANDATORY)

Before implementation, use TeamCreate to spawn 3 agents:

  1. fuse-ai-pilot:explore-codebase – Check existing variant patterns
  2. fuse-ai-pilot:research-expert – cva/class-variance-authority docs

After: Run fuse-ai-pilot:sniper for validation.


Overview

Style Characteristics Use Case
Glass Blur + transparency + glow Premium, modern, hero
Outline Border only, no fill Secondary actions
Flat Solid color, no effects Dense UI, fallback

Quick Reference

CVA Card Variants

import { cva, type VariantProps } from "class-variance-authority";

const cardVariants = cva(
  "rounded-2xl p-6 transition-all duration-200",
  {
    variants: {
      variant: {
        glass: [
          "bg-white/80 backdrop-blur-xl",
          "border border-white/20",
          "shadow-xl shadow-black/5",
        ],
        outline: [
          "bg-transparent",
          "border-2 border-primary/30",
          "hover:border-primary/50",
        ],
        flat: [
          "bg-surface",
          "border border-border",
        ],
      },
    },
    defaultVariants: {
      variant: "glass",
    },
  }
);

Button Variants

const buttonVariants = cva(
  "inline-flex items-center justify-center font-medium transition-all",
  {
    variants: {
      variant: {
        glass: "bg-white/20 backdrop-blur-md border border-white/30",
        outline: "bg-transparent border-2 border-primary text-primary",
        flat: "bg-primary text-primary-foreground",
      },
    },
  }
);

Dark Mode Per Variant

const glassVariant = {
  light: "bg-white/80 backdrop-blur-xl border-white/20",
  dark: "bg-black/40 backdrop-blur-xl border-white/10",
};

// Tailwind
className="bg-white/80 dark:bg-black/40 backdrop-blur-xl"

Validation Checklist

[ ] All 3 variants defined (glass, outline, flat)
[ ] CVA or similar variant system used
[ ] Dark mode handled per variant
[ ] Default variant specified
[ ] Hover states per variant

Best Practices

DO

  • Use CVA for type-safe variants
  • Define all three styles consistently
  • Handle dark mode per variant
  • Add hover/focus states

DON’T

  • Mix variant systems
  • Forget default variant
  • Skip dark mode
  • Ignore hover states