nativewind
БесплатноБез исполняемых скриптовНе проверенUse Tailwind CSS in React Native with NativeWind — write className instead of StyleSheet. Use when someone asks to "use Tailwind in React Native"…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
NativeWind
Overview
NativeWind lets you use Tailwind CSS classes in React Native — write className="bg-blue-500 p-4 rounded-xl" instead of StyleSheet.create({ container: { backgroundColor: '#3b82f6', padding: 16, borderRadius: 12 } }). Same Tailwind you know from web, compiled to native styles at build time. Supports dark mode, responsive breakpoints, animations, and platform-specific styles.
When to Use
- Styling React Native apps with Tailwind utilities
- Coming from web development and want familiar styling
- Need consistent design system across web and mobile
- Dark mode support without managing themes manually
- Rapid prototyping of mobile UI
Instructions
Setup with Expo (Nativewind 4.2.7, stable, Tailwind CSS 3)
Fastest start: npx rn-new --nativewind creates an Expo project already wired up. To add it to an existing project:
npx expo install [email protected] react-native-reanimated react-native-safe-area-context
npx expo install --dev tailwindcss@^3.4.17 babel-preset-expo
npx tailwindcss init
# Expo SDK 57 / Reanimated 4 also needs: npx expo install react-native-worklets
Do not run npm install tailwindcss unpinned: it now installs Tailwind 4, which Nativewind 4 does not support.
// tailwind.config.js
module.exports = {
content: ["./app/**/*.{js,jsx,ts,tsx}", "./components/**/*.{js,jsx,ts,tsx}"],
presets: [require("nativewind/preset")],
theme: { extend: {} },
plugins: [],
};
/* global.css */
@tailwind base;
@tailwind components;
@tailwind utilities;
// babel.config.js — required, without it className does nothing
module.exports = function (api) {
api.cache(true);
return {
presets: [
["babel-preset-expo", { jsxImportSource: "nativewind" }],
"nativewind/babel",
],
};
};
// metro.config.js
const { getDefaultConfig } = require("expo/metro-config");
const { withNativeWind } = require("nativewind/metro");
module.exports = withNativeWind(getDefaultConfig(__dirname), { input: "./global.css" });
// app/_layout.tsx — import global CSS once, in the root component
import "../global.css";
import { Stack } from "expo-router";
export default function Layout() {
return <Stack />;
}
For TypeScript add a nativewind-env.d.ts file containing /// <reference types="nativewind/types" /> (do not name it nativewind.d.ts). For Expo web set "web": { "bundler": "metro" } in app.json. Restart Metro with npx expo start -c after changing config files.
Nativewind 5 ([email protected], September 2026) is a release candidate for Tailwind CSS 4: it needs react-native-css, @tailwindcss/postcss, withNativewind(config) in Metro (lowercase w), CSS @import lines instead of @tailwind directives, and drops the Babel preset. Stay on 4.2.7 for production and follow https://www.nativewind.dev/v5/guides/migrate-from-v4 when you move.
Basic Usage
// components/Card.tsx — Styled with Tailwind classes
import { View, Text, Image, Pressable } from "react-native";
export function ProductCard({ product }) {
return (
<Pressable className="bg-white dark:bg-gray-800 rounded-2xl shadow-lg p-4 m-2 active:scale-95">
<Image
source={{ uri: product.image }}
className="w-full h-48 rounded-xl"
resizeMode="cover"
/>
<View className="mt-3">
<Text className="text-lg font-bold text-gray-900 dark:text-white">
{product.name}
</Text>
<Text className="text-sm text-gray-500 dark:text-gray-400 mt-1">
{product.description}
</Text>
<View className="flex-row items-center justify-between mt-3">
<Text className="text-xl font-bold text-blue-600">
${product.price}
</Text>
<Pressable className="bg-blue-600 px-4 py-2 rounded-full active:bg-blue-700">
<Text className="text-white font-semibold">Add to Cart</Text>
</Pressable>
</View>
</View>
</Pressable>
);
}
Dark Mode
// Automatic: follows the system appearance
<View className="bg-white dark:bg-gray-900">
<Text className="text-black dark:text-white">Adapts to system theme</Text>
</View>
In Expo, set "userInterfaceStyle": "automatic" in app.json, or the app stays light. A manual toggle needs darkMode: "class" in tailwind.config.js; with the default (media) setColorScheme and toggleColorScheme throw.
import { useColorScheme } from "nativewind";
function ThemeToggle() {
const { colorScheme, setColorScheme } = useColorScheme(); // setColorScheme accepts "light" | "dark" | "system"
return (
<Pressable onPress={() => setColorScheme(colorScheme === "dark" ? "light" : "dark")} className="p-3">
<Text className="text-gray-900 dark:text-white">Current: {colorScheme}</Text>
</Pressable>
);
}
Offer a "System" option next to a manual toggle and persist the choice yourself (
Установить nativewind в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл nativewind?
Use Tailwind CSS in React Native with NativeWind — write className instead of StyleSheet. Use when someone asks to "use Tailwind in React Native", "NativeWind", "style React Native with Tailwind", "className in React Native", or "utility-first styling for mobile". Covers setup, responsive design, dark mode, animations, and platform-specific styles.
Как установить скилл nativewind?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл nativewind запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic