gluestack-ui-v5:variants

Creates type-safe custom variants for gluestack-ui v5 components using tva.

Updated Sep 13, 2026
One-click install
npx skills add https://github.com/aadilmallick/myfitness-pal-clone --skill gluestack-ui-v5-variants-aadilmallick
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gluestack-ui-v5:variants
Source: https://github.com/aadilmallick/myfitness-pal-clone/tree/main/.agents/skills/gluestack-ui-v5/variants
Command: npx skills add https://github.com/aadilmallick/myfitness-pal-clone --skill gluestack-ui-v5-variants-aadilmallick

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Repeated className patterns and ad-hoc styling across a gluestack-ui v5 codebase lead to inconsistency and maintenance burden. This Skill guides the creation of reusable, type-safe component variants with tva (Tailwind Variant Authority) so design patterns are centralized and theme-compatible. ## Core Features & Use Cases - Variant Creation with tva: Define base styles, variant dimensions (variant, size, shape), default variants, and compound variants for complex combinations. - Parent-Child Variant Relationships: Use React context and parentVariants so sub-components like CardHeader respond to parent Card state. - Semantic Token Enforcement: Strict rules ensuring all variant styles use semantic tokens (bg-primary, text-muted-foreground) instead of prohibited numbered or generic color tokens, guaranteeing dark-mode compatibility. - Use Case: You notice the same status badge styles repeated across your app. Use this Skill to convert them into a StatusPill component with active/error/pending variants that automatically adapt to light and dark themes. ## Quick Start Create a Badge component with success, warning, and error variants using tva and semantic tokens for my gluestack-ui v5 project.

Frequently Asked Questions about gluestack-ui-v5:variants

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

FAQPage Schema
How do I create custom variants for gluestack-ui v5 components?

Use tva from @gluestack-ui/utils/nativewind-utils to define base styles, variant dimensions, and defaultVariants, then apply the generated class function to your component. Wrap existing Gluestack components to extend them with new variant options while preserving the originals.

What is tva in gluestack-ui and how does it work?

tva is Tailwind Variant Authority, a utility for creating type-safe, composable style variants. It accepts base classes, variant definitions, compoundVariants for specific combinations, and defaultVariants, returning a function that merges classes based on props.

How do I style child components based on parent variant state?

Share the parent's variant state through React context, then use the parentVariants option in the child's tva definition. The child reads the context values and passes them as parentVariants to compute its styles.

Can I use Tailwind color classes like bg-green-100 in gluestack variants?

No, variant styles must use only semantic tokens such as bg-primary/10, text-destructive, or bg-muted. Numbered colors, generic tokens like gray or neutral, and typography tokens are prohibited because they break automatic light and dark theme switching.

Why are my tva variants not applying to the component?

Check that your Tailwind configuration includes the tva patterns, verify the className merge order, and ensure no conflicting inline styles override the generated classes. Also confirm defaultVariants match your TypeScript variant types.

When should I create a variant instead of using className directly?

Create a variant when the same style combination repeats in multiple places, represents a project-specific design pattern, or depends on props. Use plain className for one-off styles or simple modifications of existing component props.