Type-Safe by Default
Full TypeScript inference without manual typing or
as constContext Propagation
Variants automatically flow from parent to child components
Compound Components
Build complex components with the slots pattern
Universal
Same API for React Web and React Native
The Problem
When building UI components, you often need child elements to match their parent’s style. A button’s text should match the button’s size. A card’s header should match the card’s variant. The typical solution? Prop drilling.The Solution
With better-styled, you define the relationship once. Children inherit automatically.Button.Icon and Button.Label know they should render as size="lg" and variant="primary". No repetition needed.
Quick Example
size="lg" from the parent. Clean and maintainable.
Why better-styled?
| Feature | tailwind-variants | better-styled |
|---|---|---|
| Variants | ✅ | ✅ |
| Compound Variants | ✅ | ✅ |
| Context Propagation | ❌ | ✅ |
| Compound Components | ❌ | ✅ |
| Type Inference | Needs as const | ✅ Automatic |
| React Native | ❌ | ✅ |