rds
Back to Tokens

Spacing & Layout

Spacing scale, border radius, breakpoints, and container widths

4px Base
Responsive
Tailwind CSS

Spacing Scale

Based on a 4px grid (0.25rem). Use these values for padding, margin, gap, and positioning.

NamePixelsRemVisual
00px0rem
px1px1px
0.52px0.125rem
14px0.25rem
1.56px0.375rem
28px0.5rem
2.510px0.625rem
312px0.75rem
3.514px0.875rem
416px1rem
520px1.25rem
624px1.5rem
728px1.75rem
832px2rem
936px2.25rem
1040px2.5rem
1144px2.75rem
1248px3rem
1456px3.5rem
1664px4rem

Note: Values from 24 to 96 are available but omitted from the visual table for brevity. Use p-24 through p-96 for larger spacing needs.

Common Patterns

Recommended spacing values for common UI patterns.

Component Spacing

Button paddingpx-4 py-2
Card paddingp-6
Form field gapgap-4
Section marginmb-12
Page paddingp-8

Grid & Flex Gap

Tight itemsgap-2
Default itemsgap-4
Card gridgap-6
Section gridgap-8
Large sectionsgap-12

Border Radius

Consistent border radius values for different UI elements.

rounded-none

0px

No rounding

rounded-sm

2px

Subtle rounding

rounded

4px

Default rounding

rounded-md

6px

Medium rounding (buttons)

rounded-lg

8px

Large rounding (cards)

rounded-xl

12px

Extra large rounding

rounded-2xl

16px

2x large rounding

rounded-3xl

24px

3x large rounding

rounded-full

9999px

Fully rounded (avatars)

Breakpoints

Responsive breakpoints for adaptive layouts. Mobile-first approach.

PrefixMin WidthCSSDescription
sm:640px@media (min-width: 640px)Small devices (landscape phones)
md:768px@media (min-width: 768px)Medium devices (tablets)
lg:1024px@media (min-width: 1024px)Large devices (desktops)
xl:1280px@media (min-width: 1280px)Extra large devices
2xl:1536px@media (min-width: 1536px)Extra extra large devices

Responsive Example

Item 1
Item 2
Item 3
Item 4
<div className="grid gap-4 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4">
  {items.map(item => <Card>{item}</Card>)}
</div>

Container Widths

Max-width utilities for constraining content.

max-w-xs320px
Very narrow content
max-w-sm384px
Small dialogs
max-w-md448px
Medium dialogs
max-w-lg512px
Large dialogs
max-w-xl576px
Narrow forms
max-w-2xl672px
Medium forms
max-w-3xl768px
Reading content
max-w-4xl896px
Wide content
max-w-5xl1024px
Content-focused
max-w-6xl1152px
Large content
max-w-7xl1280px
Standard page

Z-Index Scale

Layering order for overlapping elements.

z-00

Default layer

z-1010

Slightly elevated

z-2020

Dropdowns

z-3030

Fixed elements

z-4040

Sticky headers

z-5050

Modals, dialogs

z-[100]100

Toasts

z-[9999]9999

Tooltips

Usage

Examples

/* Padding */
<div className="p-4">16px all sides</div>
<div className="px-6 py-4">24px horizontal, 16px vertical</div>

/* Margin */
<div className="mb-8">32px bottom margin</div>
<div className="mt-auto">Push to bottom (flexbox)</div>

/* Gap (Flexbox/Grid) */
<div className="flex gap-4">16px gap between items</div>
<div className="grid gap-6">24px grid gap</div>

/* Responsive Spacing */
<div className="p-4 md:p-6 lg:p-8">
  Responsive padding
</div>

/* Container */
<div className="max-w-7xl mx-auto px-4">
  Centered page content
</div>