Introduction to Tamagui
Tamagui is a complete UI solution for building high-performance applications that run on both web and React Native. It combines a powerful style library, a comprehensive component kit, and an optimizing compiler to deliver exceptional performance without compromising on developer experience.What is Tamagui?
Tamagui is actually a collection of complementary libraries:- @tamagui/core - Universal style library for React
- @tamagui/static - Optimizing compiler that works with core and tamagui
- tamagui - Complete UI kit that adapts to every platform
Installation
Get started by installing Tamagui in your project
Quick Start
Build your first cross-platform component in minutes
Why Tamagui?
Learn about the benefits and use cases
Configuration
Configure themes, tokens, and design system
Key Features
Cross-Platform
Write once, run everywhere. Your components work on iOS, Android, and web with the same code.
Optimizing Compiler
The compiler flattens styled components into optimized platform-specific code -
div with atomic CSS on web, View with hoisted styles on native.Type-Safe Styling
Full TypeScript support with intelligent autocompletion for your design tokens, themes, and variants.
Rich Component Library
Comprehensive set of accessible, customizable components including Button, Dialog, Sheet, Select, and more.
Powerful Animations
Built-in animation support with multiple drivers including CSS, React Native Animated, and Reanimated.
Theming System
Sophisticated theme system with automatic dark mode, theme nesting, and dynamic theme switching.
How It Works
The magic of Tamagui lies in its optimizing compiler. It analyzes your styled components at build time and:- Extracts static styles into atomic CSS classes on web
- Hoists style objects on React Native for optimal performance
- Flattens component trees by removing unnecessary wrapper components
- Optimizes media queries and responsive styles
div. The homepage gains nearly 15% on Lighthouse with the compiler enabled.
Runtime and Compile Time
Tamagui works both at compile time and runtime, and can be adopted gradually:- Start by using the base views and
styledfunction without any build setup - Add the compiler later for production optimizations
- The entire API works the same whether compiled or not
Getting Started
The fastest way to start is with a starter template:The starters come pre-configured with the compiler, design tokens, themes, and example components to help you hit the ground running.
Example
Here’s a taste of what Tamagui code looks like:Next Steps
Install Tamagui
Set up Tamagui in your existing or new project
Quick Start Guide
Follow the step-by-step guide to build your first component