Introduction
Tamagui provides universal styling and UI components for React. All features work consistently across React Native and web.
@tamagui/coreis the base style library. It provides a web-aligned universal style system with SSR support, typed tokens, and optimized runtime performance across web and native.@tamagui/staticis an optimizing compiler that extracts style props into atomic CSS and flattens component trees at build time.Tamagui Componentsprovides accessible, composable UI primitives for web and native, including the Adapt primitive for responsive and platform-specific presentations.
Install
Add Tamagui to an app you already have: the config, the provider, and the plugin for your bundler.
Quick start
Start from a template with everything already wired up.
npm create tamagui@latestTwo ways to write styles
Tamagui ships two styling frontends. Both compile to the same atomic CSS on web and the same native styles on iOS and Android, and both accept the same tokens, themes, and media queries.
Style props on View and Text are the default. They are typed and
compile to atomic CSS on web or native styles on iOS and Android:
Tailwind classes on className are the other option, for teams who already
think in utilities:
The choice is per import path, so one app can use both. Read Components for the style prop path and Tailwind for the utility path.
Why a compiler
Cross-platform development often involves trade-offs between native feel, code reuse, and performance. React Native shares logic across platforms, but on web, styling in JavaScript can mean heavy runtime overhead and larger bundles.
Tamagui resolves this with @tamagui/static, an optimizing compiler that:
Extracts every style prop, media query, theme value, and interactive state into atomic CSS.
Removes most inline styles through partial evaluation and hoisting.
Flattens styled components into a plain div or View, so the tree gets shallower.
Turns useMedia and useTheme expressions into media queries and CSS variables.
Here is what that looks like in code:
Use inline style props or styled():
Get back perfectly optimized DOM on web (or View/Text on native).
The Text became a p and the YStack became a div. On native the same
pass produces Text and View. Flattening is where most of the speed comes
from. Across real apps around a third to a half of components flatten, and the
result on web is close to hand-written CSS. On native the output is within a
few percent of hand-optimized React Native, with the whole feature set intact.
Everything still works at runtime. The compiler is an optimization you can add later, and a component it cannot optimize simply renders the normal way. See Benchmarks for numbers and Compiler installation to turn it on.
Where to go next
- Installation sets up a project or hands the job to a coding agent.
- Components covers
html.*,View,Text, and how they render on each platform. - Styling explains style props, conditional values, and states.
- Design system introduces tokens, themes, and fonts.
- Tailwind covers the utility class frontend.
Highlights
Core depends only on React and supports the full React Native View and Text APIs, style props, styled(), hooks, and typed design tokens in ~28KB on web.
The optimizing compiler extracts styles into atomic CSS and flattens styled components at build time.
Every feature works with or without the compiler, with graceful fallback to runtime resolution.
useTheme and useMedia hooks provide fine-grained subscription updates.
Unstyled and styled variants are available for all components.
Community
Join us on:
Credits
A big thanks to:
- Stitches for the variants pattern.
- JSXStyle for providing the original version of the compiler.
- Modulz for Radix, which inspired many of our component APIs, and for the initial structure of this website.
- Framer Motion for the AnimatePresence implementation.