Skip to main content
Version: v2

Installation

info

NativeWind works with both Expo and framework-less React Native projects but Expo provides a more streamlined experience.

Web: If you'd like to use Metro to bundle for a website or App Clip and you are not using Expo, you will need either Expo's Metro config @expo/metro-config or to manually use Tailwind CLI to generate a CSS file.

tip

If you'd like to quickly setup a blank Expo project, you can use the following command:

npx create-expo-stack@latest --blank

Installation with Expo SDK 50+

1. Install NativeWind

You will need to install nativewind and its peer dependency, tailwindcss.

npm install nativewind@^2.0.0 tailwindcss@3.3.2

2. Setup Tailwind CSS

Run npx tailwindcss init to create a tailwind.config.js file.

Add the paths to all of your component files in your tailwind.config.js file.

tailwind.config.js
/** @type {import('tailwindcss').Config} */
module.exports = {
// NOTE: Update this to include the paths to all of your component files.
content: ["./App.{js,jsx,ts,tsx}", "./components/**/*.{js,jsx,ts,tsx}"],
theme: {
extend: {},
},
plugins: [],
}

3. Add the Babel preset

babel.config.js
module.exports = function (api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
plugins: ['nativewind/babel'],
};
};

4. TypeScript (optional)

Please follow the TypeScript guide.