Styling Variants
Understanding inline styles vs Tailwind CSS variants and when to use each.Comparison
Inline Styles
- No additional dependencies
- Works everywhere (web and React Native)
- Explicit, self-contained styling
- Direct control over every value
- More verbose code
- Manual dark mode logic in every component
- Repeated color values across files
- Projects without Tailwind
- React Native / Expo apps
- Developers who prefer explicit styles
Tailwind CSS
- Concise, readable code
- On React, automatic dark mode with the
dark:prefix - Integrates with design systems
- Smaller bundle with purging
- Requires Tailwind CSS 3.3 or later (4 included) on React, and NativeWind 4 (with Tailwind CSS 3) on React Native and Expo
- Learning curve if unfamiliar
- Less explicit (need to know what classes do)
- Projects already using Tailwind
- Web-only React apps
- Developers who prefer utility-first CSS
Choosing a Variant
Choose duringnpx @sublay/cli init:
Switching Variants
To switch after installation, delete the component and reinstall with the new style:React Native Styling
For React Native and Expo:- Inline Styles → Standard React Native
StyleSheet/styleprop approach - Tailwind → Uses NativeWind (
classNameprop)
Tailwind on React Native and Expo
The Tailwind variant styles everything withclassName, which works only once NativeWind is set up in your app. Without it the components render unstyled, with no error. NativeWind’s installation guide is the reference; for these components the setup is:
1
Install NativeWind and Tailwind CSS 3
2
tailwind.config.js
3
global.css, imported once
import "./global.css";4
babel.config.js
- Expo
- React Native
5
metro.config.js
- Expo
- React Native
6
TypeScript only: nativewind-env.d.ts
theme prop ("light" or "dark"), and each class is chosen from it in code.
NativeWind counts
1rem as 14 pixels on phones (Tailwind on the web counts 16). The inline styles variant uses the same 14-based sizes, so the two variants look the same.Next Steps
Colors & Theming
Customize colors
Layout & Structure
Modify layout
Adding Features
Add custom functionality
Advanced
Advanced techniques

