The easiest way to get started is using our pre-configured templates. Skip to Quick Start with Templates if you want to create a new project.
Prerequisites
Before installing NativeWind, ensure you have:- Node.js >= 20
- An existing React Native or Expo project
- React Native >= 0.81.4 (for v5)
Quick Start with Templates
The fastest way to get started is using rn-new to create a pre-configured project:Manual Installation
If you have an existing project, follow these steps to add NativeWind:Install Dependencies
Install NativeWind and its peer dependencies:
NativeWind v5 requires:
react-native-css: ^3.0.1tailwindcss: >4.1.11
Configure Metro
Update your For advanced configuration, you can pass options to
metro.config.js to use the NativeWind Metro plugin:metro.config.js
The
withNativewind function wraps your Metro config with the necessary transformers to process Tailwind CSS classes at build time.withNativewind:metro.config.js
Create Global CSS File
Create a This imports:
global.css file in your project root with the Tailwind directives:global.css
- theme.css: Tailwind’s theme configuration
- preflight.css: Base styles and CSS reset
- utilities.css: All Tailwind utility classes
- nativewind/theme: NativeWind-specific theme extensions
Import Global CSS
Import your global CSS file in your app’s entry point (usually
App.tsx or index.js):App.tsx
TypeScript Configuration (Optional)
NativeWind automatically generates TypeScript types for className props. A To disable TypeScript generation:
nativewind-env.d.ts file will be created in your project root:nativewind-env.d.ts
This file should be committed to your repository and should not be manually edited.
metro.config.js
Platform-Specific Setup
Expo Projects
For Expo projects, you may need to configure yourapp.config.ts or app.json:
app.config.ts
Bare React Native
For bare React Native projects, ensure you’re using the latest Metro version and have babel configured correctly:babel.config.js
Verification
To verify your installation is working:Troubleshooting
TypeScript Errors
If you see TypeScript errors aboutclassName not being a valid prop:
- Ensure
nativewind-env.d.tsexists in your project root - Restart your TypeScript server
- Check that the file is included in your
tsconfig.json
Styles Not Applying
If your styles aren’t applying:- Verify you’ve imported
global.cssin your app entry point - Clear Metro bundler cache:
npx expo start --clear - Ensure your Metro config is properly configured with
withNativewind
Node Version Issues
Check your Node version:Next Steps
Now that NativeWind is installed, learn how to use it:Quick Start Tutorial
Build your first component with NativeWind
Core Concepts
Learn about how NativeWind works