Concepts
Nativra's NativeWind components style themselves with Tailwind classes. NativeWind v4 compiles those classes at build time — set it up once, then every component just works.
npx expo install nativewind react-native-reanimated react-native-safe-area-contextnpm install --save-dev tailwindcss@^3.4.17/** @type {import('tailwindcss').Config} */
module.exports = {
// Include every folder Nativra writes to (see componentsDir in nativra.json)
content: ["./app/**/*.{js,jsx,ts,tsx}", "./components/**/*.{js,jsx,ts,tsx}"],
presets: [require("nativewind/preset")],
theme: {
extend: {
// Nativra components use semantic colors backed by the theme's CSS variables
colors: {
border: "rgb(var(--color-border) / <alpha-value>)",
input: "rgb(var(--color-input) / <alpha-value>)",
ring: "rgb(var(--color-ring) / <alpha-value>)",
background: "rgb(var(--color-background) / <alpha-value>)",
foreground: "rgb(var(--color-foreground) / <alpha-value>)",
primary: { DEFAULT: "rgb(var(--color-primary) / <alpha-value>)", foreground: "rgb(var(--color-primary-foreground) / <alpha-value>)" },
secondary: { DEFAULT: "rgb(var(--color-secondary) / <alpha-value>)", foreground: "rgb(var(--color-secondary-foreground) / <alpha-value>)" },
muted: { DEFAULT: "rgb(var(--color-muted) / <alpha-value>)", foreground: "rgb(var(--color-muted-foreground) / <alpha-value>)" },
accent: { DEFAULT: "rgb(var(--color-accent) / <alpha-value>)", foreground: "rgb(var(--color-accent-foreground) / <alpha-value>)" },
destructive: { DEFAULT: "rgb(var(--color-destructive) / <alpha-value>)", foreground: "rgb(var(--color-destructive-foreground) / <alpha-value>)" },
success: { DEFAULT: "rgb(var(--color-success) / <alpha-value>)", foreground: "rgb(var(--color-success-foreground) / <alpha-value>)" },
warning: { DEFAULT: "rgb(var(--color-warning) / <alpha-value>)", foreground: "rgb(var(--color-warning-foreground) / <alpha-value>)" },
info: { DEFAULT: "rgb(var(--color-info) / <alpha-value>)", foreground: "rgb(var(--color-info-foreground) / <alpha-value>)" },
card: { DEFAULT: "rgb(var(--color-card) / <alpha-value>)", foreground: "rgb(var(--color-card-foreground) / <alpha-value>)" },
popover: { DEFAULT: "rgb(var(--color-popover) / <alpha-value>)", foreground: "rgb(var(--color-popover-foreground) / <alpha-value>)" },
},
},
},
plugins: [],
};The content globs must cover your componentsDir, and the colors map connects classes like bg-primary to your theme.
module.exports = function (api) {
api.cache(true);
return {
presets: [
["babel-preset-expo", { jsxImportSource: "nativewind" }],
"nativewind/babel",
],
};
};const { getDefaultConfig } = require("expo/metro-config");
const { withNativeWind } = require("nativewind/metro");
const config = getDefaultConfig(__dirname);
module.exports = withNativeWind(config, { input: "./global.css" });@tailwind base;
@tailwind components;
@tailwind utilities;You don't write the theme variables yourself: the first nativra-cli add appends the default zinc theme to this file.
import "../global.css";
import { Stack } from "expo-router";
export default function NativeWind() {
return <Stack />;
}/// <reference types="nativewind/types" />init picks NativeWind automatically when it finds nativewind or a Tailwind config. If you initialized earlier with StyleSheet, set "stylingTarget": "nativewind" in nativra.json; new add runs then install the NativeWind versions.
npx nativra-cli add buttonglobal.css import is missing, or content doesn't include your components folder. Restart Metro with --clear after config changes.nativewind-env.d.ts and make sure it is included by your tsconfig.npx nativra-cli doctor — it checks the NativeWind setup and can scaffold a missing Tailwind config with --fix.