component-variant

Generate tailwind-variants definitions and React/React Native components with variant props.

1|Updated Jan 13, 2023
One-click install
npx skills add https://github.com/theodrosyimer/.dotfiles --skill component-variant
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: component-variant
Source: https://github.com/theodrosyimer/.dotfiles/tree/main/claude/skills/ds__component-variant
Command: npx skills add https://github.com/theodrosyimer/.dotfiles --skill component-variant

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Provides a consistent, repeatable way to define tailwind-variants (tv()) and implement React/React Native components that consume them, reducing duplicated styling, preventing ad-hoc utility usage, and ensuring cross-platform compatibility.

Core Features & Use Cases

  • Variant Definitions: Create framework-agnostic tv() definitions that centralize base styles, variants, compoundVariants, and defaultVariants.
  • Component Consumption: Build React and React Native components that import variant definitions, export inferred variant prop types, and accept class/className overrides for safe merging.
  • Patterns & Compatibility: Support slots for multi-element components, extendable base components, semantic token naming, and Uniwind compatibility for web/native parity.

Quick Start

Create a new tv() definition for a Button in packages/ui/src/variants/button.ts and a corresponding Button component in packages/ui/src/components/Button.tsx that imports the variant and exports the inferred ButtonVariants type.

Frequently Asked Questions about component-variant

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

FAQPage Schema
How do I create tailwind-variants definitions for React components?

You create tailwind-variants definitions by generating a tv() function that centralizes base styles, variants, compoundVariants, and defaultVariants, then build a React component that imports this definition and exports the inferred variant prop types for type-safe usage.

What is the best way to standardize UI component styling across React and React Native?

Standardizing UI component styling across React and React Native involves generating framework-agnostic tailwind-variants definitions and implementing components that consume them, ensuring Uniwind compatibility for web and native rendering parity while preventing ad-hoc utility usage.

Can I use tailwind-variants slots for multi-element React components?

Yes, tailwind-variants supports slots for multi-element React components, allowing you to map distinct style rules to different parts of a component within a single tv() definition while maintaining a unified variant API.

How do I allow class overrides in a tailwind-variants component?

Allowing class overrides in a tailwind-variants component requires the component to accept class or className props, which safely merges consumer-supplied utility classes with the base tv() definition styles for controlled customization.

Does this approach support compound variants and semantic token naming?

Yes, this approach supports compoundVariants to apply styles based on multiple variant combinations, and it enforces semantic token utility classes within the tv() output to maintain a consistent design system vocabulary.

When should I not use tailwind-variants for component development?

You should avoid using tailwind-variants if your project lacks a Tailwind CSS setup or if your application requires highly dynamic, runtime-computed styling that cannot be predefined within static variant maps and compoundVariants configurations.