About tailwind-variants
A reference skill for coding agents working with Tailwind Variants, including recipes, slots, composition, class merging, and major-version migrations. It emphasizes compatibility between package and Tailwind CSS versions.
Key features
- 01Variant and compound variant guidance
- 02Slots and compound slots
- 03Composition with extend and VariantProps
- 04Class merging and conflict resolution
- 05Default and lite build guidance
- 06Major-version migration notes
Use cases
- 01Defining component styles with variants
- 02Composing shared style recipes
- 03Resolving conflicting utility classes
- 04Migrating Tailwind Variants across versions
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ dobroslavradosavljevic/ skills --skill tailwind-variantsAfter installing, type/tailwind-variantsin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
agents/openai.yamlreferences/composition-typescript.mdproduction-migration.mdsetup-core.mdsource-map.mdvariants-slots.mdDetails
From the project READMETailwind Variants
Use this skill when work touches Tailwind Variants (tv, slots, compound variants, extend, cn/cx/cnMerge, /lite, or migrations across TV majors).
Workflow
- Inspect the local styling stack before changing code:
- Packages:
tailwind-variantsversion, Tailwind CSS major (v4vsv3), optional directtailwind-mergeusage, Prettier Tailwind plugin. - Import path: default
tailwind-variantsvstailwind-variants/lite. - Patterns in use: single-element
tv, slots,extend, sharedcreateTV/defaultConfig,VariantPropson components.
- Packages:
- Refresh docs when versions are unclear or work touches merge config, lite builds, or major upgrades. Start from source-map.md.
- For install, default vs lite builds,
cn/cnMerge/cx, and config, use setup-core.md. - For
variants, boolean/compound variants, slots, andcompoundSlots, use variants-slots.md. - For
extend, overrides, TypeScriptVariantProps, and DX tooling, use composition-typescript.md. - For conflict resolution, custom
twMergeConfig, and v0/v1/v2/v3 migrations, use production-migration.md.
Implementation Judgment
- Pair TV v3.x with Tailwind CSS v4.x. If the project is still on Tailwind CSS v3, use
tailwind-variantsv0.x (or upgrade Tailwind first). - Prefer the default build (
import { tv, cn } from 'tailwind-variants') for design-system work. Use/liteonly when bundle size matters and merge is unnecessary. - On v3.3.0+, conflict resolution is built into the default build—do not require
tailwind-mergesolely for TV. Keeptailwind-mergeonly if the app calls it directly. Pin v3.3.1+ when using slots (v3.3.0 leaked slot state between interleaved calls). - Omit
slotsfor a string-returning recipe. Passingslots: {}enables slot mode (implicitbaseslot)—avoid accidental empty-slot objects. - Prefer
extendfor typed composition over string-splicingtvresults intobasearrays. - Use
class/classNameprops for consumer overrides; let merge resolve conflicts when enabled. - Type React/Vue props with
VariantProps<typeof recipe>. Make variants required withOmit/Requiredwhen defaults are wrong. - Do not use removed
responsiveVariants. Put responsive prefixes (md:,lg:) in the class strings themselves. - Prefer
cxover deprecatedcnBase. Prefercnfor merged joins; usecnMergeonly for per-call merge config.
Verification
Prefer the repo's existing checks. For meaningful Tailwind Variants changes, include the relevant subset:
- Typecheck for
VariantProps, slot return shapes, andextendmerges. - Unit assertions on recipe output strings for critical variant/compound combinations (especially with merge on/off).
- Visual/browser smoke for overridden slots and composed components.
- Bundle check when switching default ↔
/liteor adding heavytwMergeConfig. - IntelliSense/
tailwindFunctions: ['tv']sanity if editors stop completing classes insidetv.
Comments
Markdown supported