Skip to content

Guide · Open source

How to use Tamagui: install, style components and share code

Updated · written with AI from the project's own documentation and checked against our catalogue data

Tamagui is a set of open-source libraries for building user interfaces that run on both the web with React and on phones with React Native, using one shared codebase. This guide explains what each part does, how to start a project with the official starter command, and how the optional compiler fits in. By the end you will know where to begin and which trade-offs to check before adopting it.

Tamaguitamagui/tamagui · ★ 14.3k · MIT

Quick start

  1. 1Check prerequisites. Make sure Node.js and npm are installed, and that you are comfortable with React and TypeScript.
  2. 2Create a starter project. Run npm create tamagui@latest and choose a starter that matches your goal.
  3. 3Open the project and run it. Follow the instructions the starter prints and start the app for the platform you want to test.
  4. 4Read the docs. Use tamagui.dev to learn the current import names and styled API.
  5. 5Adopt gradually. Begin with the base views and styled function in one part of an existing app.
  6. 6Enable the compiler when useful. Add the optional compiler once you have styled components worth optimizing, and measure the result yourself.

What Tamagui includes

Tamagui is split into three packages, and you can use them together or separately. The core package is a universal style library for React. The static package is an optimizing compiler that works with core and the UI kit. The UI kit is a ready-made set of components that adapts to each platform.

  • @tamagui/core: universal style library for React
  • @tamagui/static: optimizing compiler that works with core and tamagui
  • tamagui: UI kit that adapts to every platform

Install Tamagui with the starter command

The README recommends starting from one of the official starters rather than wiring everything up by hand. The starters range from a simple learning example to a production-ready monorepo. Prerequisites are Node.js and npm, and the setup assumes you know React and TypeScript.

Run the command below in the terminal where you want the project folder created.

  • Install Node.js and npm first.
  • Pick a starter: the simple example is best for learning, the monorepo for production work.
npm create tamagui@latest

Use the base views and styled function

The source says that initial usage can be as simple as importing Tamagui and using the base views and the styled function. You can adopt it gradually inside an existing app rather than rewriting everything at once.

The README does not show code for these APIs, so check the documentation at tamagui.dev for exact usage before you copy any examples.

  • Start with a few components, not the whole app.
  • Read the docs for the current import names and styled syntax.

Understand what the compiler does

The optional compiler turns styled components, including those with complex logic or cross-module imports, into simpler output. On the web it becomes a div with atomic CSS. On native it becomes a View with its style objects hoisted.

The README reports one measurement: on the Tamagui website, 49 of about 55 inline styled components in one responsive browser section are flattened to a div, and the homepage gains nearly 15% on Lighthouse with the compiler on. Treat this as the authors' own result, not a guarantee for your app.

  • The compiler works at compile time and runtime.
  • You can turn it on later as you grow into it.

Contribute or read the docs

Documentation lives on the project website. The README points to a contributing guide for code changes and says the docs source is in code/tamagui.dev/data/docs/ for documentation edits.

  • Full documentation: tamagui.dev
  • Contributing guide: CONTRIBUTING.md in the repository
  • Docs source: code/tamagui.dev/data/docs/

What people use it for

  • Building one app that runs on the web and on iOS or Android from a shared codebase.
  • Sharing styling between React Native and react-native-web projects.
  • Adding a styled design system to an existing React app in stages.
  • Using the optional UI kit as a starting point and customizing it to a brand.

Frequently asked questions

Is Tamagui free to use?

Yes. Tamagui is released under the MIT licence, which allows use, modification and distribution, including in commercial projects. Check the LICENSE file in the repository for the full terms.

What are the requirements for Tamagui?

The listed prerequisites are Node.js and npm. The project is built around React and TypeScript, so you should know both before starting.

How do I install Tamagui?

The README recommends running npm create tamagui@latest to create a starter project. Pick the starter that fits your level and goals.

Is Tamagui good for beginners?

Not really. The setup assumes React and TypeScript experience. If you only need a plain website without React, Tamagui is not the right fit.

How does Tamagui compare to NativeWind or React Native Paper?

Comparable projects include React Native Paper, NativeWind, Gluestack UI and Restyle. Tamagui combines a styling library, an optional UI kit and a compiler, so compare based on whether you need those parts together. Try a small prototype with each before committing.

Can I use Tamagui without the UI kit?

Yes. The UI kit is optional, and the core styling library can be used on its own. The README lists the packages separately.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Tamagui suits teams building the same product for web and native with React and TypeScript, especially if they want shared styling and an optional compiler. It is a poor choice for plain websites without React, or for developers new to React and TypeScript who need a simple, fixed design.

Install options & downloads