Skip to main content
Version: 1.1.0
Last Updated: 2026-04-08
Status: Active
UI/UX Guide: For full UI/UX standards including design system, page templates, navigation, and accessibility, see UI_UX_STANDARDS.md. Scope: This file is spacing/layout specific; keep broad UI policy in UI_UX_STANDARDS.md to avoid duplication.
This document consolidates spacing and UX standards from previous review documents to provide a single source of truth for spacing patterns, responsive design, and UX consistency across the Encore OS platform.

Quick Reference

Standard Spacing Scale

Common Patterns

Page Container:
Vertical Spacing:
Grid Spacing:
Form Spacing:
Card Padding:

Helper Components

  • PageContainer - Consistent responsive page-level padding
  • ResponsiveFormLayout - Responsive column layouts for forms
  • MobileTableWrapper - Horizontal scroll wrapper for wide tables

Best Practices

  1. ✅ Always use responsive spacing - space-y-4 md:space-y-6
  2. ✅ Use PageContainer - Don’t manually add container padding
  3. ✅ Consistent grid gaps - gap-3 md:gap-4 lg:gap-6
  4. ✅ Mobile-first - Start with mobile spacing, scale up
  5. ❌ Avoid fixed padding on all screen sizes
  6. ❌ Avoid double padding (container + explicit)
  7. ❌ Avoid inconsistent spacing patterns
For detailed patterns and examples, see sections below.

Table of Contents

Core Patterns

Dialog & Sheet Sizes

Spacing Guidelines

Component Patterns

Dialog & Sheet Sizing

Migration & Reference


Dialog Size Tiers

Full Reference: See .cursor/rules/dialog-size-standards.md for complete standards and decision guide.
Audit: See docs/development/UI_CONSISTENCY_REVIEW.md for the full UI consistency audit.

Standard Dialog Sizes

Standard Sheet Sizes

Dialog Sizing Rules

  1. ALWAYS include sm: responsive prefix
  2. NEVER use arbitrary pixel values ([425px], [500px], etc.)
  3. NEVER add overflow-y-auto to DialogContent (base handles it)
  4. NEVER add max-h-* to DialogContent (base provides sm:max-h-[85vh])

Page Container Pattern

Standard Implementation

Responsive Padding

Recommended Pattern:
  • Mobile: 16px (py-4 px-4)
  • Tablet: 24px (md:py-6 md:px-6)
  • Desktop: 32px (lg:py-8 lg:px-8)
Avoid:
  • ❌ Fixed padding on all screen sizes
  • ❌ Double padding (container + explicit padding)
  • ❌ Container default padding (32px) on mobile

Overview Page Wrapper Pattern

When to Use

Use OverviewPageWrapper for:
  • Module landing pages (e.g., /hr, /rh, /fa)
  • Any page that needs pull-to-refresh with query invalidation
  • Pages following the standard overview structure

Standard Implementation

Props Reference


Critical Requirement: Content Expansion

Problem: Content must expand when sidebar collapses to utilize available space. Sidebar Dimensions:
  • Expanded: 16rem (256px)
  • Collapsed: 3rem (48px)
  • Available space when collapsed: +208px
Solution Pattern:

Implementation Guidelines

  1. Use flex-1 on content container to fill available space
  2. Remove fixed max-width or use responsive max-width
  3. Use w-full to ensure content uses full available width
  4. Test sidebar collapse to verify content expansion

Container Padding Standards

Standard Patterns

Pattern 1: Responsive Padding (Recommended)
Pattern 2: Horizontal + Vertical Separate
Pattern 3: PageContainer Component (Preferred)

Anti-Patterns to Avoid

❌ Double Padding:
❌ Fixed Padding on Mobile:
❌ Inconsistent Patterns:

Vertical Spacing

Standard Patterns

Between Sections:
Between Cards:
Responsive Spacing:

Guidelines

  • Use space-y-* for vertical spacing between children
  • Use gap-* for grid/flex layouts
  • Scale spacing responsively: smaller on mobile, larger on desktop
  • Maintain consistent spacing scale (4, 6, 8, not 4, 5, 7)

Card Padding

Standard Patterns

Responsive Card Padding:
Guidelines:
  • Mobile: p-4 (16px) - Prevents cramped cards
  • Tablet+: p-6 (24px) - Comfortable spacing
  • Avoid p-6 on mobile (too large)

Dialog Size Tiers

Use only these standard tiers for DialogContent. Always include the sm: prefix. Do not use arbitrary pixel values (e.g. max-w-[425px]). The base dialog already provides sm:max-h-[85vh] and overflow; do not add max-h-* or overflow-y-auto on DialogContent.

Sheet Size Tiers

Use only these standard tiers for SheetContent. Always include the sm: prefix.

Dialog/Sheet Decision Guide

  • Confirmation or 1–5 fields? → Dialog Small (sm:max-w-md) or Sheet Default/Medium
  • Standard form (4–8 fields)? → Dialog Medium (sm:max-w-lg) or Sheet Large
  • Multiple sections or tabs? → Dialog Large (sm:max-w-2xl)
  • Table or comparison view? → Dialog X-Large (sm:max-w-3xl)
  • Document preview or full editor? → Dialog Full (sm:max-w-4xl) or Sheet Wide
See also: .cursor/rules/dialog-size-standards.md for full rules and examples; docs/development/index.md for current migration and review status references.

Mobile-First Considerations

Touch Targets

  • Minimum: 44x44px (per constitution.md §6.7)
  • Recommended: 48x48px for primary actions
  • Spacing between targets: 8px minimum

Safe Area Insets

Responsive Breakpoints


Grid Layouts

Responsive Grid Patterns

Standard Grid:
Guidelines:
  • Start with single column on mobile
  • Add columns at tablet breakpoint (md:)
  • Use consistent gap spacing (4, 6, 8)

Form Spacing

Standard Patterns

Form Field Spacing:
Form Section Spacing:

Table Spacing

Standard Patterns

Table Padding:
For Wide Tables on Mobile:
Table Spacing Guidelines:
  • Mobile: 12px (p-3)
  • Desktop: 16px (md:p-4)
  • Header Height: Mobile 40px (h-10), Desktop 48px (md:h-12)

Section Headers

Standard Patterns

Standard Section Header:
With Description:

Page Header Pattern

Standard Implementation

Stats Bar Pattern

Standard Implementation

Content Grid Pattern

Standard Implementation

Migration Checklist

When updating a page to follow spacing standards:
  • Replace container mx-auto p-6 with PageContainer
  • Replace space-y-6 with space-y-4 md:space-y-6
  • Replace gap-4/gap-6 with gap-3 md:gap-4 lg:gap-6
  • Update manual margins to use spacing system
  • Test on mobile (320px), tablet (768px), desktop (1024px+)
  • Verify no horizontal scrolling
  • Verify content doesn’t touch edges

Troubleshooting Common Issues

Content Touching Screen Edges on Mobile

Problem: Content appears to touch the left/right edges on mobile devices. Solution:

Inconsistent Spacing Between Breakpoints

Problem: Spacing jumps dramatically between mobile and desktop. Solution:

Horizontal Scrolling on Mobile

Problem: Page scrolls horizontally on mobile devices. Solution:
  1. Check for fixed-width elements: Remove w-{fixed} classes
  2. Use responsive grid: grid-cols-1 md:grid-cols-2
  3. Check container: Ensure PageContainer is used, not manual padding
  4. Verify safe areas: Check for elements extending beyond viewport

Content Overlapping with Sidebar

Problem: Content overlaps when sidebar is visible. Solution:

Grid Items Too Close Together

Problem: Grid items have insufficient spacing. Solution:

Form Fields Too Tight

Problem: Form fields appear cramped. Solution:

Cards Have Inconsistent Padding

Problem: Some cards have different padding than others. Solution:

Review History

This document consolidates content from:
  • This document consolidates content from SPACING_AND_SIDEBAR_ADAPTIVE_REVIEW.md (archived 2025-12-08)
  • This document consolidates content from SPACING_AND_UX_REVIEW.md (archived 2025-01-27)
  • SPACING_QUICK_REFERENCE.md (2025-01-27) - Quick reference guide (consolidated)
Key Issues Addressed:
  1. Content expansion when sidebar collapses
  2. Container padding consistency
  3. Responsive spacing patterns
  4. Mobile-first design
  5. Dead space elimination

  • Constitution: constitution.md §6.7 - UI/UX guardrails
  • Navigation Standards: docs/architecture/NAVIGATION_STANDARD.md - Navigation patterns
  • UI/UX Standards: docs/development/UI_UX_STANDARDS.md - Full UI/UX guide
  • Dialog/Sheet size rules: .cursor/rules/dialog-size-standards.md - Required size tiers and anti-patterns
  • UI consistency review: docs/development/UI_CONSISTENCY_REVIEW.md - Migration status and remaining work