# Common Layout Patterns
## Overview
This document catalogs common UI layout patterns and their Tailwind CSS implementations to help quickly translate design screenshots into code.
## 1. Single Column Layout
**Description**: Content centered in a single column with max-width constraint.
**Common Use Cases**:
- Blog posts
- Article pages
- Simple forms
- Landing pages
**Tailwind Implementation**:
```tsx
```
**Variants**:
- Narrow: `max-w-xl` (576px)
- Standard: `max-w-2xl` (672px)
- Wide: `max-w-4xl` (896px)
## 2. Sidebar Layout (Fixed Sidebar)
**Description**: Fixed-width sidebar with flexible content area.
**Common Use Cases**:
- Admin dashboards
- Documentation sites
- Application settings
- Email clients
**Tailwind Implementation**:
```tsx
{/* Sidebar */}
{/* Main Content */}
{/* Content */}
```
**Responsive Variant**:
```tsx
{/* Mobile: Hidden sidebar with toggle */}
{/* Content */}
```
**Common Sidebar Widths**:
- Narrow: `w-48` (192px)
- Standard: `w-64` (256px)
- Wide: `w-80` (320px)
## 3. Header + Content Layout
**Description**: Fixed header with scrollable content below.
**Common Use Cases**:
- Most web applications
- Marketing sites
- Blogs
**Tailwind Implementation**:
```tsx
{/* Header */}
{/* Main Content */}
{/* Content */}
```
**Common Header Heights**:
- Compact: `h-12` (48px)
- Standard: `h-16` (64px)
- Tall: `h-20` (80px)
## 4. Grid Layout (Cards/Products)
**Description**: Responsive grid of equal-sized items.
**Common Use Cases**:
- Product listings
- Image galleries
- Card collections
- Feature showcases
**Tailwind Implementation**:
```tsx
{items.map(item => (
{/* Card content */}
))}
```
**Common Grid Configurations**:
- 2 columns: `grid-cols-1 md:grid-cols-2`
- 3 columns: `grid-cols-1 md:grid-cols-2 lg:grid-cols-3`
- 4 columns: `grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4`
- Auto-fit: `grid-cols-[repeat(auto-fit,minmax(250px,1fr))]`
**Common Gap Sizes**:
- Tight: `gap-2` or `gap-4`
- Standard: `gap-6`
- Spacious: `gap-8` or `gap-10`
## 5. Split Screen Layout
**Description**: Two equal or weighted sections side by side.
**Common Use Cases**:
- Login pages (form + image)
- Feature comparisons
- Before/after views
**Tailwind Implementation (50/50)**:
```tsx
{/* Left Section */}
{/* Content */}
{/* Right Section */}
{/* Content */}
```
**Tailwind Implementation (40/60)**:
```tsx
{/* Smaller section */}
{/* Larger section */}
```
## 6. Holy Grail Layout
**Description**: Header, footer, sidebar, and main content area.
**Common Use Cases**:
- Complex dashboards
- Enterprise applications
- Content management systems
**Tailwind Implementation**:
```tsx
{/* Header */}
{/* Main area with sidebar */}
{/* Sidebar */}
{/* Main Content */}
{/* Content */}
{/* Footer */}
```
## 7. Dashboard Layout (Stats Grid)
**Description**: Grid of metric/stat cards.
**Common Use Cases**:
- Analytics dashboards
- Admin panels
- Monitoring systems
**Tailwind Implementation**:
```tsx
{stats.map(stat => (
{stat.label}
{stat.value}
{stat.change}
))}
```
## 8. Centered Modal/Card
**Description**: Single card or modal centered on page.
**Common Use Cases**:
- Login forms
- Registration forms
- Simple wizards
- Coming soon pages
**Tailwind Implementation**:
```tsx
```
**Common Card Widths**:
- Small: `max-w-sm` (384px)
- Medium: `max-w-md` (448px)
- Large: `max-w-lg` (512px)
## 9. List + Detail (Master-Detail)
**Description**: List of items on left, selected item details on right.
**Common Use Cases**:
- Email clients
- Messaging apps
- File browsers
- Contact lists
**Tailwind Implementation**:
```tsx
{/* List */}
{items.map(item => (
{/* List item */}
))}
{/* Detail */}
{/* Selected item details */}
```
## 10. Hero Section
**Description**: Large banner section with headline and CTA.
**Common Use Cases**:
- Landing pages
- Marketing sites
- Product pages
**Tailwind Implementation**:
```tsx
Your Headline Here
Supporting text that explains the value proposition
Call to Action
```
**Common Hero Heights**:
- Short: `py-16` or `py-20`
- Medium: `py-24` or `py-32`
- Full viewport: `min-h-screen flex items-center`
## 11. Tab Layout
**Description**: Tabbed interface with content panels.
**Common Use Cases**:
- Settings pages
- Profile pages
- Multi-step forms
- Product details
**Tailwind Implementation**:
```tsx
{/* Tab Headers */}
Tab 1
Tab 2
{/* Tab Content */}
{/* Active tab content */}
```
## 12. Sticky Sidebar + Content
**Description**: Sidebar that sticks while content scrolls.
**Common Use Cases**:
- Documentation
- Long-form articles with TOC
- Product pages with filters
**Tailwind Implementation**:
```tsx
{/* Sticky Sidebar */}
{/* Scrollable Content */}
{/* Long content */}
```
## Common Spacing Patterns
### Container Padding
- Mobile: `px-4` (16px)
- Tablet: `md:px-6` (24px)
- Desktop: `lg:px-8` (32px)
### Vertical Spacing
- Section gaps: `py-12` or `py-16` or `py-24`
- Component gaps: `space-y-6` or `space-y-8`
- Content gaps: `space-y-4`
### Max Width Containers
- Small: `max-w-4xl` (896px)
- Medium: `max-w-5xl` (1024px)
- Large: `max-w-6xl` (1152px)
- Extra Large: `max-w-7xl` (1280px)
## Responsive Strategy
### Mobile First Approach
Always start with mobile layout, then add larger breakpoints:
```tsx
// Mobile: Stack vertically
// Tablet: 2 columns
// Desktop: 3 columns
```
### Common Breakpoints (Tailwind)
- `sm`: 640px (small tablets)
- `md`: 768px (tablets)
- `lg`: 1024px (laptops)
- `xl`: 1280px (desktops)
- `2xl`: 1536px (large desktops)
### Hiding Elements Responsively
```tsx
// Show on mobile only
Mobile menu
// Hide on mobile
Desktop menu
// Show on tablet and up
Tablet+ content
```