Skip to content
Tutorials Center
My learning

Topics

Lesson 13 of 71 ยท Styling and Layout

Styling Libraries and Design Systems

Compare NativeWind, Tamagui, Unistyles and component libraries for React Native, learn what each solves, and build a tiny style helper to see how they work.

You can build a whole app with nothing but StyleSheet.create, and many good apps do. But as a project grows, the same questions keep coming back. Where do the colors live? How do you make a button come in three sizes? How do you switch to dark mode without editing fifty files? Styling libraries and design systems exist to answer those questions once, so every screen answers them the same way.

This lesson is a map, not a recommendation list. You will see the main approaches, what each one costs, and how to choose. You already know the basics from Styling with StyleSheet and Theming and Dark Mode; here we build on them.

What runs on this site. None of these libraries can run here, because they depend on the native runtime and on build tooling such as Babel and Metro plugins. The setup code below is read-only. The runnable examples are stand-ins: a tiny utility-class helper and a tiny variant helper written in plain React, so you can see the idea each library is built on. They are not the real libraries.

Why go beyond StyleSheet?

Plain style objects have no built-in concept of a design system. You can add one yourself (a theme.ts file with colors and spacing), and for a small app that is the right answer. The pain appears later:

  • Repetition. The same padding, radius and color combinations are copied into many files.
  • Variants. A button with size and intent options turns into a pile of conditional style arrays.
  • Themes and breakpoints. StyleSheet.create runs once, so values that depend on the color scheme or screen size must be computed in the component.
  • Consistency across a team. Nothing stops one developer from using #2563eb and another from using #2564eb.

Four ways to style

StyleSheet Built in. Objects and your own theme file.
Utility classes Write className strings like p-4 bg-blue-600.
Themed styles Style functions that receive theme tokens.
Component kits Ready-made buttons, inputs and dialogs.

Each step trades more tooling for less repetition.

1 / 2

Utility classes: NativeWind

NativeWind brings Tailwind CSS to React Native. You write class names in a className prop, and a build step turns them into native style objects. If your team already uses Tailwind on the web, the vocabulary is the same: p-4, bg-blue-600, rounded-lg, flex-row.

JSX
import { View, Text, Pressable } from 'react-native';

export function PrimaryButton({ label, onPress }) {
  return (
    <Pressable
      onPress={onPress}
      className="rounded-lg bg-blue-600 px-4 py-3 active:bg-blue-700"
    >
      <Text className="text-center font-semibold text-white">{label}</Text>
    </Pressable>
  );
}

Setup is more than an install. You add a tailwind.config.js, a global CSS file that imports Tailwind, a Babel preset and a Metro configuration wrapper. The exact steps change between NativeWind versions, so follow the current official instructions instead of copying an old guide. The pay-off is dark-mode variants (dark:bg-slate-900), state variants (active:), and the ability to share vocabulary with a web codebase.

The trade-offs: long class strings can be hard to read, and some web-only Tailwind features simply do not exist on native (there is no cascade and no hover on a phone).

Themed style functions: Unistyles

Unistyles keeps the familiar StyleSheet.create shape, but lets you pass a function that receives the current theme (and runtime information such as screen size). You declare your themes and breakpoints once, then every stylesheet can use them.

JSX
import { StyleSheet } from 'react-native-unistyles';

const styles = StyleSheet.create((theme) => ({
  card: {
    backgroundColor: theme.colors.surface,
    padding: theme.spacing(2),
    borderRadius: 12,
    variants: {
      tone: {
        info: { borderColor: theme.colors.info },
        danger: { borderColor: theme.colors.danger },
      },
    },
  },
}));

Its main selling point is that theme changes and breakpoint changes update styles without re-rendering your React components, because the work happens on the native side. The cost is that it relies on native code, so it needs a development build rather than Expo Go, and on the New Architecture in current versions.

Tokens, themes and a compiler: Tamagui

Tamagui is both a styling system and a UI kit. You define design tokens (sizes, colors, radii) and themes, build components with styled(), and use stack primitives like XStack and YStack. An optional compiler tries to flatten components into plain views at build time to reduce runtime work, and the same code can target the web.

JSX
import { styled, YStack, Text } from 'tamagui';

const Card = styled(YStack, {
  padding: '$4',
  borderRadius: '$4',
  backgroundColor: '$background',
  variants: {
    elevated: { true: { shadowOpacity: 0.15, elevation: 4 } },
  },
});

Tamagui is powerful, and also the heaviest to learn: tokens, themes, the compiler and its configuration are a lot to hold at once. It pays off most for teams sharing one design system across web and native.

Styled wrappers and component libraries

Two more families are worth knowing:

  • CSS-in-JS wrappers such as styled-components/native and Shopify's Restyle let you write styled components or typed theme-aware props. They run in JavaScript at render time, which is fine for most screens.
  • Component libraries give you finished widgets. React Native Paper implements Material Design, gluestack-ui offers unstyled-first, themeable components, and React Native Elements provides general-purpose widgets. They save the most time for forms, dialogs and menus, but your app will look like the library unless you theme it carefully.

A fair rule: pick a styling approach first (StyleSheet, NativeWind, Unistyles or Tamagui), then decide whether a component library on top of it earns its place. Mixing two full design systems in one app is a recipe for inconsistent spacing and doubled bundle size.

How utility classes work: a stand-in

Under the hood, a utility-class library keeps a table that maps class names to style properties and merges them. This stand-in does that with ten rules. It is not NativeWind (the real thing runs at build time and understands far more), but it shows the core idea, and why a typo simply produces no style.

A tiny utility-class helper

Variants and themes: another stand-in

The second idea every library shares is the variant: a button defined once with options such as size and intent, which resolve to styles. Tamagui calls them variants, Unistyles has variants, and the class-variance-authority pattern does the same job on the web.

Variants driven by a theme

How to choose

Match the tool to the team and the project, not to the hype:

  • Small app, solo developer, or learning: plain StyleSheet plus a small theme.ts. Zero setup, zero lock-in.
  • Team that already loves Tailwind: NativeWind. The shared vocabulary is the benefit.
  • Heavy theming and breakpoints, performance-sensitive screens: Unistyles.
  • One design system for web and native, with a team willing to learn it: Tamagui.
  • Need working forms, dialogs and menus quickly: add a component library, and theme it to match your brand.

Whatever you choose, keep your tokens (colors, spacing, radii, font sizes) in one place, use them everywhere, and avoid mixing several systems. A migration later is far easier when screens use named tokens instead of raw values.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does NativeWind let you write in React Native?

    NativeWind brings Tailwind CSS vocabulary to React Native through className, and a build step converts the classes to native styles. There is still no cascade and no HTML.
  2. 2. Which approach is built around a style function that receives the current theme and breakpoints?

    Unistyles keeps the StyleSheet.create shape but lets you pass a function that receives the theme and runtime values, so themes and breakpoints are declared once.
  3. 3. What is a good reason to start a small app with plain StyleSheet and a theme file?

    StyleSheet is built in, so there is nothing to configure and nothing to migrate away from. You can adopt a library later if repetition becomes painful.
  4. 4. In the stand-in utility helper, what happens to a class name that has no matching rule?

    A typo in a utility class does not fail loudly, it just produces no style. That is why editor tooling and lint rules for class names are useful.

Summary

  • Styling libraries remove repetition, provide variants and make themes and breakpoints easy; plain StyleSheet is still a good default for small apps.
  • NativeWind uses Tailwind-style className; Unistyles uses theme-aware style functions; Tamagui adds tokens, a compiler and a UI kit; Restyle and styled-components are JavaScript-side wrappers.
  • Component libraries (Paper, gluestack-ui, React Native Elements) save time on finished widgets but need theming to avoid a generic look.
  • Keep design tokens in one place and avoid mixing several full styling systems.
  • On this site the libraries are read-only; the runnable examples are small stand-ins for the utility-class and variant ideas.

Next, start building interactive screens with Text and TextInput.