2
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill fusengine/agents --skill component-variants- SKILL.md2.6 KB
Overview
This skill helps teams implement multi-style UI components using class-variance-authority (CVA) patterns. It codifies three consistent visual variants—Glass, Outline, and Flat—plus dark mode and hover behaviors. Use it to standardize variant props, default values, and validation for component libraries.
How this skill works
The skill provides CVA configurations and example variant definitions for cards, buttons, and other primitives. It enforces a checklist: define glass/outline/flat variants, use CVA (or an equivalent typed variant system), specify a default variant, and include dark-mode and hover states. It also includes an agent workflow to research existing patterns and validate the final implementation.
When to use it
- Building new reusable components that need multiple visual styles
- Migrating or refactoring existing components to a consistent variant system
- Creating design-system tokens that must support light and dark themes
- Implementing variant props with type-safety in TypeScript
- Adding hover, focus, and accessibility-aware states to variants
Best practices
- Use CVA for type-safe, composable variant definitions
- Define all three variants (glass, outline, flat) for consistency
- Set a sensible default variant to avoid undefined styling
- Provide dark-mode alternatives per variant rather than global overrides
- Add hover and focus states to each variant for predictable interactions
Example use cases
- Card component with cva-based variant prop and default set to glass
- Button primitive exposing variant prop: glass, outline, flat with typed VariantProps
- Theme-aware components switching border/fill for dark and light modes
- Component migration where each existing style maps to one of the three canonical variants
- Automated validation step that checks variant presence, CVA usage, defaults, and hover states
FAQ
Glass uses blur, transparency, and glow for premium surfaces; Outline is border-only for secondary actions; Flat is solid color without effects for dense or fallback UI.
Do I have to use CVA?
You should use CVA or a similar typed variant utility for consistency and type-safety, but the pattern can be adapted if your stack provides equivalent tools.
How should dark mode be handled?
Provide per-variant dark values (e.g., glass.light vs glass.dark) instead of a single global swap. This ensures visual intent remains across themes.