Overview
Uniwind includes a built-in CSS parser that allows you to use traditional CSS alongside Tailwind utilities. While our primary focus is on Tailwind syntax, you can write custom CSS classes and use them directly in your React Native components.We’re actively seeking feedback to identify missing features and limitations. Your input helps us improve CSS support in Uniwind!
Why Use Custom CSS?
While Tailwind provides utility classes for most styling needs, custom CSS can be useful for:- Complex, reusable component styles that would be verbose with utilities
- Migrating existing web codebases to React Native
- Defining design system components with consistent styling
- Advanced animations and transitions
Basic Usage
Define custom CSS classes in yourglobal.css
file and use them with the className
prop:
CSS Definition
global.css
Using in Components
Combining CSS Classes with Tailwind
You can seamlessly mix custom CSS classes with Tailwind utilities:CSS Definition
global.css
Usage with Tailwind
Using light-dark() Function
Uniwind supports the CSSlight-dark()
function, which provides a convenient way to define different values for light and dark themes:
The
light-dark()
function is particularly useful for maintaining color consistency across themes without needing separate CSS variables for each theme.Best Practices
Prefer Tailwind utilities for simple styles. Use custom CSS classes for complex, reusable component patterns that would be verbose or repetitive with utility classes.
Avoid deeply nested selectors. React Native’s styling model is simpler than web CSS. Keep your selectors flat and component-scoped for best results.
Recommended Pattern
Performance Considerations
- Compile-time parsing: CSS is parsed at build time, not runtime, for optimal performance
- No runtime overhead: Custom CSS classes are converted to React Native styles during compilation
Feedback & Feature Requests
The CSS parser is continuously evolving. We’re actively looking for feedback to help identify missing features and limitations.
Share Your Feedback
Let us know what CSS features you need or issues you’ve encountered!