Tamagui

screenshot of Tamagui
react
react-native
vite
tailwind

Tamagui

Cross platform React style library and UI kit made faster with an optimizing compiler.

Overview

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.

Features

  • Universal style system: Tamagui includes @tamagui/core, which is a style system that can be used for both web and native apps.
  • Optimizing compiler: Tamagui also includes @tamagui/static, an optimizing compiler that works with core and tamagui. This compiler generates platform-specific optimizations and improves runtime performance.
  • Flattening of styled components: The optimizing compiler can flatten a large percentage of styled components in your app, resulting in improved performance. It understands a rich "CSS-in-JS" style system and can flatten even inline styles with logic into flattened nodes.
  • Atomic CSS and partially evaluated code: The compiler generates atomic CSS and partially evaluated code, which further enhances runtime performance.
  • Easy contribution: Tamagui is a monorepo that makes it easy to contribute to the project.

Installation

To install Tamagui and set up a development environment, follow these steps:

  1. Run the build watcher in a dedicated terminal:

    # Run the build watcher
    npm run watch
    
  2. Use the sandbox project to test and develop things for the web:

    # Use the sandbox project for web development
    npm run sandbox:web
    
  3. To test on native, use the kitchen-sink project:

    # Use the kitchen-sink project for native testing
    npm run kitchen-sink
    
  4. Create a development build:

    # Create a development build
    npm run build:dev
    
  5. Run the site in development mode to test if it works at runtime:

    # Run the site in development mode
    npm run dev
    
  6. If everything looks good, run the site with the compiler enabled:

    # Run the site with the compiler enabled
    npm run dev:compiler
    
  7. 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.

Summary

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.

react
React

React is a widely used JavaScript library for building user interfaces and single-page applications. It follows a component-based architecture and uses a virtual DOM to efficiently update and render UI components

react-native
React Native

React Native is a framework for building mobile applications using React and JavaScript. It enables developers to write once and deploy to multiple platforms, including iOS, Android, and the web, while providing a native app-like experience to users.

vite
Vite

Vite is a build tool that aims to provide a faster and leaner development experience for modern web projects

tailwind
Tailwind

Tailwind CSS is a utility-first CSS framework that provides pre-defined classes for building responsive and customizable user interfaces.

ui-kit
UI Kits & Components

A UI kit provides developers with a set of reusable components that can be easily integrated into a website or application. These components are pre-designed with consistent styling and functionality, allowing developers to save time and effort in the design and development process. UI kits can be either custom-built or third-party, and often include components for buttons, forms, typography, icons, and more.

typescript
Typescript

TypeScript is a superset of JavaScript, providing optional static typing, classes, interfaces, and other features that help developers write more maintainable and scalable code. TypeScript's static typing system can catch errors at compile-time, making it easier to build and maintain large applications.

webpack
Webpack

Webpack is a popular open-source module bundler for JavaScript applications that bundles and optimizes the code and its dependencies for production-ready deployment. It can also be used to transform other types of assets such as CSS, images, and fonts.