Style React fast with 100% parity on React Native, an optional UI kit, and optimizing compiler.
Tamagui is a complete universal UI kit built for both web and native apps. It includes @tamagui/core, which is a universal style system, and @tamagui/static, an optimizing compiler that works with core and tamagui. The goal of Tamagui is to allow developers to share more code between web and native apps while maintaining a high level of performance and code maintainability. It achieves this through an optimizing compiler that generates platform-specific optimizations and a “CSS-in-JS” style system that can flatten even inline styles with logic into flattened nodes. This results in significant runtime performance improvements.
To install Tamagui and set up a development environment, follow these steps:
Run the build watcher in a dedicated terminal:
# Run the build watcher
npm run watch
Use the sandbox project to test and develop things for the web:
# Use the sandbox project for web development
npm run sandbox:web
To test on native, use the kitchen-sink project:
# Use the kitchen-sink project for native testing
npm run kitchen-sink
Create a development build:
# Create a development build
npm run build:dev
Run the site in development mode to test if it works at runtime:
# Run the site in development mode
npm run dev
If everything looks good, run the site with the compiler enabled:
# Run the site with the compiler enabled
npm run dev:compiler
Finally, build the site for production and test it:
# Build the site for production
npm run build
By following these steps, you can ensure that Tamagui works well with various environments and configurations, including Vite, Webpack, Metro, Next.js with SSR, and with the compiler both on and off. Integration tests will be added in the future to cover all combinations of environments.
Tamagui is a universal UI kit designed for both web and native apps. It includes a universal style system and an optimizing compiler that generates platform-specific optimizations. The compiler can flatten styled components and improves runtime performance by generating atomic CSS and partially evaluated code. Tamagui is easy to contribute to, and developers can set up a development environment by following the provided installation steps.