wwwwwwwwwwwwwwwwwww

Installation

Get Tamagui set up, step by step

We recommend using npm create to set up one or more of the example apps via npm create tamagui. It's useful even if integrating into an existing app.

Install

The base Tamagui style library @tamagui/core has only one dependency - react.

yarn add @tamagui/core

If you want tamagui, you can avoid installing core and instead use tamagui everywhere as it's a superset of core:

yarn add tamagui

Add TamaguiProvider at the root of your app and you are fully set up:

// optional but recommended CSS reset:
import '@tamagui/core/reset.css'
import { TamaguiProvider, View } from '@tamagui/core'
export default () => (
<TamaguiProvider>
<View width={200} height={200} backgroundColor="red" />
</TamaguiProvider>
)

Tamagui doesn't require any bundler setup for either web or native, but you'll typically want to configure a few things using createTamagui like media queries, fonts, or tokens. The configuration documentation covers this in detail, but if you'd like to get started with decent defaults, you'll want @tamagui/config:

import { TamaguiProvider, createTamagui } from '@tamagui/core'
import { config } from '@tamagui/config/v3'
// you usually export this from a tamagui.config.ts file
const tamaguiConfig = createTamagui(config)
// make TypeScript type everything based on your config
type Conf = typeof tamaguiConfig
declare module '@tamagui/core' {
interface TamaguiCustomConfig extends Conf {}
}
export default () => {
return (
<TamaguiProvider config={tamaguiConfig}>
{/* your app here */}
</TamaguiProvider>
)
}

You should be ready to use any component:

import { Button } from 'tamagui'
export default function Demo() {
return <Button>Hello world</Button>
}

From here, we'd recommend spending some time understanding configuration. Tamagui works 100% the same at runtime as at compile-time, so you can wait until you're needing some extra performance to set up the compiler.

Guides

Tamagui generally doesn't require any special bundler setup, but React Native Web and the ecosystem of React Native packages often do. Tamagui provides a variety of plugins for compatibility and simplifying compiler setup.

We also have more in-depth guides:

Previous

Introduction

Next

Introduction