How styling works
NativeWind brings Tailwind CSS to React Native by processing your styles at build time and using an optimized runtime to apply them. Instead of using StyleSheet.create, you write Tailwind utility classes directly in your components.The className prop
NativeWind enables theclassName prop on React Native components, allowing you to use Tailwind utilities just like in web development:
NativeWind processes your styles during the build step, not at runtime. This means your app stays fast and performant.
Build-time processing
NativeWind uses the Tailwind CSS compiler to process your styles during your application’s build step. This approach provides several benefits:Fast runtime
Styles are pre-computed, so there’s minimal work at runtime
Small bundle
Only the styles you use are included in your bundle
Type safety
Full TypeScript support for className strings
CSS features
Access to CSS variables, media queries, and more
Platform-specific styling
NativeWind provides platform-specific variants to conditionally apply styles based on the platform:- iOS variant
- Android variant
- Native variant
- Web variant
Available platform variants
ios
ios
Applies styles only on iOS devices and simulators.
android
android
Applies styles only on Android devices and emulators.
native
native
Applies styles on both iOS and Android, but not web.
web
web
Applies styles only when running on web platforms.
tv
tv
Applies styles only on TV platforms (tvOS, Android TV).
Custom utilities
NativeWind includes custom utilities specifically designed for React Native. These utilities map to native props and features:Elevation (Android)
Theelevation-* utility applies Android-specific elevation shadows:
| Class | Elevation value |
|---|---|
elevation-xs | 1 |
elevation-sm | 3 |
elevation-md | 6 |
elevation-lg | 8 |
elevation-xl | 13 |
elevation-2xl | 24 |
elevation-none | 0 |
Tint color
Thetint-* utility sets the tint color for components that support it:
Ripple effects (Android)
Android ripple effects can be customized with special utilities:Text styling
NativeWind handles text styling with platform-specific considerations:Line height
React Native requires unitless values for line-height. NativeWind automatically converts theleading-* utilities:
The
leading-* utility is automatically converted from rem units to unitless values that React Native can understand.System fonts
NativeWind configures platform-specific system fonts:- iOS fonts
- Android fonts
Best practices
Use platform variants strategically
Apply platform-specific styles only when necessary. Most Tailwind utilities work across all platforms:
Leverage build-time processing
Since styles are processed at build time, you can use complex class names without runtime performance concerns:
Next steps
Theming
Learn how to customize colors and design tokens
Dark mode
Implement dark mode in your application
Responsive design
Create responsive layouts with breakpoints
Custom styles
Create your own custom utilities and variants