Overview
Uniwind provides two powerful tools for styling third-party components that don’t natively supportclassName
props.
Option 1: withUniwind (Recommended)
Wrap third-party components to addclassName
support using withUniwind
:
Best for: Components you use frequently throughout your app. Wrap them once, use them everywhere with
className
support.withUniwind Documentation
Learn how to wrap components and map custom props
Option 2: useResolveClassNames
Convert className strings to style objects at runtime:Best for: One-off usage or components with complex style requirements that can’t be easily wrapped.
useResolveClassNames Documentation
Learn how to convert classNames to style objects
Quick Comparison
Feature | withUniwind | useResolveClassNames |
---|---|---|
Setup | Once per component | Per usage |
Performance | Optimized | Slightly slower |
Best for | Reusable components | One-off cases |
Syntax | className="..." | style={...} |
Example: react-native-paper
Example: react-navigation
For most third-party components,
withUniwind
is the recommended approach as it provides better performance and cleaner syntax.