Skip to main content

Overview

Uniwind supports Tailwind’s responsive breakpoint system out of the box, allowing you to create adaptive layouts that respond to different screen sizes. Use breakpoint prefixes like sm:, md:, lg:, and xl: to apply styles conditionally based on screen width.
Uniwind uses the same breakpoint syntax as Tailwind CSS. If you’re familiar with Tailwind on the web, you already know how to use breakpoints in React Native!

Default Breakpoints

Uniwind includes five default breakpoints based on common device sizes:
All breakpoints use a mobile-first approach. This means unprefixed utilities (like p-4) apply to all screen sizes, and prefixed utilities (like md:p-8) apply at the specified breakpoint and above.

Basic Usage

Apply different styles at different breakpoints using the breakpoint prefix:
How it works:
  • On screens < 640px: Uses p-4 and text-base
  • On screens ≥ 640px: Uses p-6 and text-lg
  • On screens ≥ 1024px: Uses p-8 and text-xl

Mobile-First Design

Uniwind uses a mobile-first breakpoint system, meaning you style for mobile first, then add styles for larger screens:

❌ Don’t style desktop-first

✅ Do style mobile-first

Start with the mobile layout (no prefix), then use sm:, md:, lg: to progressively enhance for larger screens.

Common Patterns

Responsive Layouts

Create layouts that adapt to screen size:

Responsive Spacing

Adjust padding and margins based on screen size:

Responsive Visibility

Show or hide elements at different breakpoints:

Custom Breakpoints

You can customize breakpoints to match your specific design needs using the @theme directive in your global.css:
global.css

Adding Custom Breakpoints

You can also add entirely new breakpoints:
global.css
Usage:

Best Practices

Design mobile-first: Start with mobile styles and progressively enhance for larger screens. This ensures a solid foundation for all devices.
Use semantic breakpoint names: When adding custom breakpoints, use meaningful names like tablet, desktop, or ultrawide instead of arbitrary values.
Avoid too many breakpoints: Stick to 3-5 breakpoints maximum. Too many breakpoints make your code harder to maintain and can lead to inconsistent designs.

Tailwind Basics

Learn the fundamentals of using Tailwind with Uniwind

Platform Selectors

Combine breakpoints with platform-specific styles

Global CSS

Customize breakpoints in your global.css file

Supported Class Names

See all supported Tailwind utilities
For more details on Tailwind’s responsive design system, check the official Tailwind documentation.