Last updated on February 18, 2026
Functions & Directives
Overview
Nativewind allows the same functions and directives as Tailwind CSS. Please refer to the Tailwind CSS documentation.
These functions can be used within your theme, arbitrary class names, or within your custom CSS.
In addition to the functions and directives provided by Tailwind CSS, Nativewind polyfills the following CSS functions:
var()
var() is a CSS function that allows you to use the value of a custom property (sometimes called a "CSS variable") inside the value of another property.
calc()
calc() is a CSS function that allows you to perform calculations when specifying CSS property values. It can be used to perform addition, subtraction, multiplication, and division and can be used with other CSS functions such as var()
Supported Modes
Nativewind supports calc() with the following unit types:
- Numerical (
px):calc(10px + 100px)resolves to110 - Percentage (
%):calc(var(--width) + 20%)resolves to"30%"(when--widthis10%) remunits:calc(2rem * 5)resolves correctly using the platform rem valueemunits:calc(2em * 2)resolves relative to the element's font size- CSS variables:
calc(var(--variable) + 20px)resolves with the variable's runtime value - Inside color functions:
hsl(calc(var(--H) + 20), calc(var(--S) - 10%), calc(var(--L) + 30%))works for dynamic color calculations
Limitations
Mixing Unit Types
React Native's layout engine does not support mixing numerical and percentage units in the same expression. Ensure all operands use the same unit type.
Custom Properties
Nativewind does not support operations in custom properties. Instead, you can use calc() with custom properties by first defining the custom property and then using calc() to perform the operation.
env()
env() is a CSS function that allows you to access device specific environment information.
Nativewind supports:
Please see Safe Area Insets for more information.