Skip to main content

Styling Variants

Understanding inline styles vs Tailwind CSS variants and when to use each.

Comparison


Inline Styles

Pros:
  • No additional dependencies
  • Works everywhere (web and React Native)
  • Explicit, self-contained styling
  • Direct control over every value
Cons:
  • More verbose code
  • Manual dark mode logic in every component
  • Repeated color values across files
Best for:
  • Projects without Tailwind
  • React Native / Expo apps
  • Developers who prefer explicit styles

Tailwind CSS

Pros:
  • Concise, readable code
  • Automatic dark mode with dark: prefix
  • Integrates with design systems
  • Smaller bundle with purging
Cons:
  • Requires Tailwind CSS installed
  • Learning curve if unfamiliar
  • Less explicit (need to know what classes do)
Best for:
  • Projects already using Tailwind
  • Web-only React apps
  • Developers who prefer utility-first CSS

Choosing a Variant

Choose during npx @sublay/cli init:
If you’re unsure: choose Inline Styles. It works everywhere with no setup.

Switching Variants

To switch after installation, delete the component and reinstall with the new style:
This replaces your component files. Back up any customizations before switching.

React Native Styling

For React Native and Expo:
  • Inline Styles → Standard React Native StyleSheet / style prop approach
  • Tailwind → Uses NativeWind (className prop)
NativeWind must be installed and configured for the Tailwind variant to work on React Native.

Next Steps

Colors & Theming

Customize colors

Layout & Structure

Modify layout

Adding Features

Add custom functionality

Advanced

Advanced techniques