Data selectors let you conditionally apply styles based on a component’s props using Tailwind-style variants. This mirrors the familiar data-[state=open]:... pattern from Tailwind v4 and allows React Native components to react to their own prop values.
Use the data-[prop=value] variant with your classes. The name inside the brackets maps to a data-<prop> prop on the same component.
Copy
import { View } from 'react-native'// Use your own data-* props on React Native components<View data-state={isOpen ? 'open' : 'closed'} className="p-4 rounded border data-[state=open]:bg-muted/50 data-[state=closed]:bg-transparent"/>
Inside brackets, use the name without the data- prefix (e.g., state targets the data-state prop)
The utility applies only when the prop equals the given value
import { View } from 'react-native'// Match a specific value on your own data-* prop<View data-state={isOpen ? 'open' : 'closed'} className="data-[state=open]:bg-muted/50 data-[state=closed]:bg-transparent"/>
During build, Uniwind recognizes attribute selectors generated by variants like data-[prop=value]:... and records them as data constraints for the corresponding class
At runtime, when resolving a component’s className, Uniwind compares the component’s props against those constraints and only applies the matching styles
Styles that depend on data selectors are evaluated against props and are not cached across prop changes