Gluestack UI v4 Design Patterns
This skill enforces constrained, opinionated styling patterns for gluestack-ui v4 that reduce decision fatigue, improve performance, enable consistent theming, and limit the solution space to canonical patterns.
Core Principles
- Gluestack components over React Native primitives - Gluestack wraps RN with theming, accessibility, and cross-platform consistency
- Component props over className utilities - Use built-in props (size, variant, space) instead of className when available
- Semantic tokens ONLY - NO EXCEPTIONS - NEVER use generic tokens (
typography-*, neutral-*, gray-*) or numbered colors (red-500, blue-600). ONLY use semantic tokens (text-foreground, bg-primary, border-border, etc.) with optional alpha values
- className over inline styles - Inline styles bypass optimization and consistency
- Spacing scale over pixel values - Arbitrary values create unsustainable exceptions
- Copy-paste philosophy - Components are copied into your codebase, not installed as dependencies
- Composable sub-components - Use compound component patterns for flexibility
- Remove dead code - Unused patterns mislead AI and increase cognitive load
When to Use This Skill
- Creating new components with styling
- Reviewing existing component styles
- Refactoring styles to follow the design system
- Fixing styling inconsistencies
- Adding dark mode support
- Theming components
- Copying components from gluestack-ui into your project
Before using any component, always verify the latest usage patterns at https://v4.gluestack.io/ui/docs/components/${componentName}/
Sub-Skills Organization
This skill is organized into specialized sub-skills for better token efficiency:
1. gluestack-ui-v4:setup
Use for: Initial project setup, installation, configuration, adding components
Covers:
- Using the official CLI (
npx gluestack-ui@alpha init -y and npx gluestack-ui@alpha add --all -y)
- Project initialization for Expo, React Native CLI, and Next.js
- Dependency management
- Configuration files (tailwind, metro, babel, etc.)
- GluestackUIProvider setup
- Adding individual components
- Troubleshooting setup issues
Invoke when: Setting up gluestack-ui in a new or existing project, adding components via CLI, or troubleshooting installation issues
2. gluestack-ui-v4:creating-components
Use for: Step-by-step component creation, templates, recipes
Covers:
- Component creation workflow
- 6 ready-to-use templates (simple, variants, compound, form, interactive, loading)
- Common component recipes (profile cards, badges, search, lists)
- Best practices checklist
- Quick start guide
Invoke when: Creating new components from scratch or need component templates
3. gluestack-ui-v4:components
Use for: Component usage, compound patterns, icons, provider setup
Covers:
- Using Gluestack components over React Native primitives
- Component props vs className utilities
- Compound component patterns (Input, Button, FormControl, etc.)
- Icon usage hierarchy
- Provider setup
Invoke when: Working with component structure, props, and composition
4. gluestack-ui-v4:styling
Use for: Colors, spacing, dark mode, variants, className
Covers:
- Semantic color tokens
- Spacing scale adherence
- Dark mode with CSS variables
- Variant-based styling with tva
- className merging
Invoke when: Styling components, theming, or working with colors and spacing
5. gluestack-ui-v4:variants
Use for: Creating custom variants for components, extending design system
Covers:
- When and how to create variants
- Using tva for variant management
- Extending existing Gluestack components
- Parent-child variant relationships
- Compound variants for complex combinations
- Common variant patterns (badges, alerts, cards)
- Converting repeated styles to variants
Invoke when: Need to create custom variants for components, extend component styling options, or standardize repeated style patterns
6. gluestack-ui-v4:performance
Use for: Cross-platform, performance optimization, best practices
Covers:
- Cross-platform rendering (Native & Web)
- TypeScript usage
- Component memoization
- Animations with Reanimated
- Safe area handling
- FlatList for lists
- Platform-specific code
Invoke when: Optimizing performance, ensuring cross-platform compatibility, or following React Native best practices
7. gluestack-ui-v4:validation
Use for: Code review, anti-patterns, validation checklist
Covers:
- Complete validation checklist
- Anti-patterns to avoid
- Common mistakes
- Escalation guidance
Invoke when: Reviewing code, validating implementation, or checking for anti-patterns
Quick Reference
Resolution Hierarchy (in order of preference)
- Component props - Use built-in props (size, variant, space)
- className utilities - Use existing Tailwind/NativeWind classes
- Gluestack component variants - Use built-in component variants
- tva (Tailwind Variant Authority) - Create reusable variant patterns
- NativeWind interop - Enable className on third-party components
- Inline styles - Only as absolute last resort with documented justification
Common Patterns
// Component usage with props
<VStack space="lg" className="p-4">
<Heading size="xl" bold>Title</Heading>
<Text size="md" className="text-muted-foreground">Description</Text>
</VStack>
// Button with compound components
<Button variant="outline" size="lg">
<ButtonText>Click Me</ButtonText>
<ButtonIcon as={ChevronRightIcon} />
</Button>
// Input with icon (InputIcon MUST be in InputSlot)
<Input>
<InputSlot>
<InputIcon as={MailIcon} className="text-muted-foreground" />
</InputSlot>
<InputField placeholder="Enter email" />
</Input>
// Semantic color tokens
<Box className="bg-primary text-primary-foreground">
<Text className="text-foreground">Content</Text>
</Box>
Key Rules Summary
- Always use Gluestack components instead of React Native primitives
- Use component props (space, size, variant) instead of className when available
- CRITICAL: ONLY semantic tokens for colors - NEVER use
typography-*, neutral-*, gray-*, slate-*, or numbered colors (red-500, blue-600). ONLY use semantic tokens: text-foreground, text-muted-foreground, bg-primary, bg-card, border-border, etc. with optional alpha values (/70, /90)
- No inline styles unless absolutely necessary
- Follow spacing scale (0, 0.5, 1, 2, 3, 4, etc.) - no arbitrary values
- Compound components required - ButtonText, InputSlot, FormControlLabel, etc.
- InputIcon MUST be wrapped in InputSlot - this is critical
- Use tva for variants when creating custom components with multiple styles
- Dark mode with dark: prefix - uses CSS variables
- Cross-platform compatible - use Gluestack wrappers, not direct React Native imports
Reference Documentation
IMPORTANT: Always verify component usage and patterns in the official v4 documentation before using components.
- Component Docs:
https://v4.gluestack.io/ui/docs/components/${componentName}/
- Complete Documentation: https://v4.gluestack.io/ui/docs
- Import Path:
@/components/ui/${componentName}
How to Use Sub-Skills
When working on specific tasks, invoke the appropriate sub-skill for detailed guidance:
- Setting up gluestack-ui or adding components? → Use
gluestack-ui-v4:setup
- Creating a new component? → Use
gluestack-ui-v4:creating-components
- Component structure questions? → Use
gluestack-ui-v4:components
- Styling and theming questions? → Use
gluestack-ui-v4:styling
- Creating or extending component variants? → Use
gluestack-ui-v4:variants
- Performance or cross-platform questions? → Use
gluestack-ui-v4:performance
- Need to validate or review code? → Use
gluestack-ui-v4:validation
Each sub-skill provides focused, detailed guidance on its specific domain while maintaining consistency with these core principles.
1---2name: gluestack-ui-v43description: Enforces constrained, opinionated styling patterns for gluestack-ui v4. Main overview skill that coordinates specialized sub-skills for setup, components, styling, variants, performance, and validation.4---5
6# Gluestack UI v4 Design Patterns
7
8This skill enforces constrained, opinionated styling patterns for gluestack-ui v4 that reduce decision fatigue, improve performance, enable consistent theming, and limit the solution space to canonical patterns.
9
10## Core Principles
11
121. **Gluestack components over React Native primitives** - Gluestack wraps RN with theming, accessibility, and cross-platform consistency
132. **Component props over className utilities** - Use built-in props (size, variant, space) instead of className when available
143. **Semantic tokens ONLY - NO EXCEPTIONS** - NEVER use generic tokens (`typography-*`, `neutral-*`, `gray-*`) or numbered colors (`red-500`, `blue-600`). ONLY use semantic tokens (`text-foreground`, `bg-primary`, `border-border`, etc.) with optional alpha values
154. **className over inline styles** - Inline styles bypass optimization and consistency
165. **Spacing scale over pixel values** - Arbitrary values create unsustainable exceptions
176. **Copy-paste philosophy** - Components are copied into your codebase, not installed as dependencies
187. **Composable sub-components** - Use compound component patterns for flexibility
198. **Remove dead code** - Unused patterns mislead AI and increase cognitive load
20
21## When to Use This Skill
22
23- Creating new components with styling
24- Reviewing existing component styles
25- Refactoring styles to follow the design system
26- Fixing styling inconsistencies
27- Adding dark mode support
28- Theming components
29- Copying components from gluestack-ui into your project
30
31**Before using any component, always verify the latest usage patterns at `https://v4.gluestack.io/ui/docs/components/${componentName}/`**
32
33## Sub-Skills Organization
34
35This skill is organized into specialized sub-skills for better token efficiency:
36
37### 1. gluestack-ui-v4:setup
38**Use for:** Initial project setup, installation, configuration, adding components
39
40Covers:
41- Using the official CLI (`npx gluestack-ui@alpha init -y` and `npx gluestack-ui@alpha add --all -y`)
42- Project initialization for Expo, React Native CLI, and Next.js
43- Dependency management
44- Configuration files (tailwind, metro, babel, etc.)
45- GluestackUIProvider setup
46- Adding individual components
47- Troubleshooting setup issues
48
49**Invoke when:** Setting up gluestack-ui in a new or existing project, adding components via CLI, or troubleshooting installation issues
50
51### 2. gluestack-ui-v4:creating-components
52**Use for:** Step-by-step component creation, templates, recipes
53
54Covers:
55- Component creation workflow
56- 6 ready-to-use templates (simple, variants, compound, form, interactive, loading)
57- Common component recipes (profile cards, badges, search, lists)
58- Best practices checklist
59- Quick start guide
60
61**Invoke when:** Creating new components from scratch or need component templates
62
63### 3. gluestack-ui-v4:components
64**Use for:** Component usage, compound patterns, icons, provider setup
65
66Covers:
67- Using Gluestack components over React Native primitives
68- Component props vs className utilities
69- Compound component patterns (Input, Button, FormControl, etc.)
70- Icon usage hierarchy
71- Provider setup
72
73**Invoke when:** Working with component structure, props, and composition
74
75### 4. gluestack-ui-v4:styling
76**Use for:** Colors, spacing, dark mode, variants, className
77
78Covers:
79- Semantic color tokens
80- Spacing scale adherence
81- Dark mode with CSS variables
82- Variant-based styling with tva
83- className merging
84
85**Invoke when:** Styling components, theming, or working with colors and spacing
86
87### 5. gluestack-ui-v4:variants
88**Use for:** Creating custom variants for components, extending design system
89
90Covers:
91- When and how to create variants
92- Using tva for variant management
93- Extending existing Gluestack components
94- Parent-child variant relationships
95- Compound variants for complex combinations
96- Common variant patterns (badges, alerts, cards)
97- Converting repeated styles to variants
98
99**Invoke when:** Need to create custom variants for components, extend component styling options, or standardize repeated style patterns
100
101### 6. gluestack-ui-v4:performance
102**Use for:** Cross-platform, performance optimization, best practices
103
104Covers:
105- Cross-platform rendering (Native & Web)
106- TypeScript usage
107- Component memoization
108- Animations with Reanimated
109- Safe area handling
110- FlatList for lists
111- Platform-specific code
112
113**Invoke when:** Optimizing performance, ensuring cross-platform compatibility, or following React Native best practices
114
115### 7. gluestack-ui-v4:validation
116**Use for:** Code review, anti-patterns, validation checklist
117
118Covers:
119- Complete validation checklist
120- Anti-patterns to avoid
121- Common mistakes
122- Escalation guidance
123
124**Invoke when:** Reviewing code, validating implementation, or checking for anti-patterns
125
126## Quick Reference
127
128### Resolution Hierarchy (in order of preference)
129
1301. **Component props** - Use built-in props (size, variant, space)
1312. **className utilities** - Use existing Tailwind/NativeWind classes
1323. **Gluestack component variants** - Use built-in component variants
1334. **tva (Tailwind Variant Authority)** - Create reusable variant patterns
1345. **NativeWind interop** - Enable className on third-party components
1356. **Inline styles** - Only as absolute last resort with documented justification
136
137### Common Patterns
138
139```tsx
140// Component usage with props
141<VStack space="lg" className="p-4">
142 <Heading size="xl" bold>Title</Heading>
143 <Text size="md" className="text-muted-foreground">Description</Text>
144</VStack>
145
146// Button with compound components
147<Button variant="outline" size="lg">
148 <ButtonText>Click Me</ButtonText>
149 <ButtonIcon as={ChevronRightIcon} />
150</Button>
151
152// Input with icon (InputIcon MUST be in InputSlot)
153<Input>
154 <InputSlot>
155 <InputIcon as={MailIcon} className="text-muted-foreground" />
156 </InputSlot>
157 <InputField placeholder="Enter email" />
158</Input>
159
160// Semantic color tokens
161<Box className="bg-primary text-primary-foreground">
162 <Text className="text-foreground">Content</Text>
163</Box>
164```
165
166## Key Rules Summary
167
1681. **Always use Gluestack components** instead of React Native primitives
1692. **Use component props** (space, size, variant) instead of className when available
1703. **CRITICAL: ONLY semantic tokens for colors** - NEVER use `typography-*`, `neutral-*`, `gray-*`, `slate-*`, or numbered colors (`red-500`, `blue-600`). ONLY use semantic tokens: `text-foreground`, `text-muted-foreground`, `bg-primary`, `bg-card`, `border-border`, etc. with optional alpha values (`/70`, `/90`)
1714. **No inline styles** unless absolutely necessary
1725. **Follow spacing scale** (0, 0.5, 1, 2, 3, 4, etc.) - no arbitrary values
1736. **Compound components required** - ButtonText, InputSlot, FormControlLabel, etc.
1747. **InputIcon MUST be wrapped in InputSlot** - this is critical
1758. **Use tva for variants** when creating custom components with multiple styles
1769. **Dark mode with dark: prefix** - uses CSS variables
17710. **Cross-platform compatible** - use Gluestack wrappers, not direct React Native imports
178
179## Reference Documentation
180
181**IMPORTANT: Always verify component usage and patterns in the official v4 documentation before using components.**
182
183- **Component Docs**: `https://v4.gluestack.io/ui/docs/components/${componentName}/`
184- **Complete Documentation**: https://v4.gluestack.io/ui/docs
185- **Import Path**: `@/components/ui/${componentName}`
186
187## How to Use Sub-Skills
188
189When working on specific tasks, invoke the appropriate sub-skill for detailed guidance:
190
191- **Setting up gluestack-ui or adding components?** → Use `gluestack-ui-v4:setup`
192- **Creating a new component?** → Use `gluestack-ui-v4:creating-components`
193- **Component structure questions?** → Use `gluestack-ui-v4:components`
194- **Styling and theming questions?** → Use `gluestack-ui-v4:styling`
195- **Creating or extending component variants?** → Use `gluestack-ui-v4:variants`
196- **Performance or cross-platform questions?** → Use `gluestack-ui-v4:performance`
197- **Need to validate or review code?** → Use `gluestack-ui-v4:validation`
198
199Each sub-skill provides focused, detailed guidance on its specific domain while maintaining consistency with these core principles.