Last updated on September 14, 2026

Units

Edit

Supported Units

Nativewind v5 supports the following CSS units on native:

UnitNameDescription
pxPixelsTreated as density-independent pixels (dp) on native. 10px becomes 10 in React Native.
%PercentageRelative to the parent container, same as CSS.
vwViewport WidthPolyfilled using Dimensions.get('window').width. Reactive to window size changes.
vhViewport HeightPolyfilled using Dimensions.get('window').height. Reactive to window size changes.
remRoot EMRelative to the root font size. Default is 14 on native, 16 on web.
emEMRelative to the current element's font size.

Ratios

Ratio values like aspect-ratio: 16 / 9 are supported natively.

dp vs px

React Native's default unit is density-independent pixels (dp) while the web uses pixels (px). Nativewind treats them as equivalent: 10px in CSS becomes 10 in React Native's style system. When defining values in your theme, use px units and Nativewind will handle the conversion.

rem Sizing

React Native's <Text /> renders with a default fontSize: 14, while the web default is 16px. Nativewind uses an rem value of 14 on native and 16 on web to maintain visual consistency with Tailwind's spacing scale.

You can override the rem value using CSS:

:root {
  font-size: 16px;
}

The rem value is not a runtime JavaScript setting in v5. For dimensions that change at runtime, use a CSS variable through VariableContextProvider and preserve it with inlineVariables.exclude; see Dynamic Themes.

On this page