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:Helper Components
- PageContainer - Consistent responsive page-level padding
- ResponsiveFormLayout - Responsive column layouts for forms
- MobileTableWrapper - Horizontal scroll wrapper for wide tables
Best Practices
- ✅ Always use responsive spacing -
space-y-4 md:space-y-6 - ✅ Use PageContainer - Don’t manually add container padding
- ✅ Consistent grid gaps -
gap-3 md:gap-4 lg:gap-6 - ✅ Mobile-first - Start with mobile spacing, scale up
- ❌ Avoid fixed padding on all screen sizes
- ❌ Avoid double padding (container + explicit)
- ❌ Avoid inconsistent spacing patterns
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.mdfor complete standards and decision guide.
Audit: Seedocs/development/UI_CONSISTENCY_REVIEW.mdfor the full UI consistency audit.
Standard Dialog Sizes
Standard Sheet Sizes
Dialog Sizing Rules
- ALWAYS include
sm:responsive prefix - NEVER use arbitrary pixel values (
[425px],[500px], etc.) - NEVER add
overflow-y-autotoDialogContent(base handles it) - NEVER add
max-h-*toDialogContent(base providessm: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)
- ❌ Fixed padding on all screen sizes
- ❌ Double padding (container + explicit padding)
- ❌ Container default padding (32px) on mobile
Overview Page Wrapper Pattern
When to Use
UseOverviewPageWrapper 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
Sidebar Adaptive Layout
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
Implementation Guidelines
- Use
flex-1on content container to fill available space - Remove fixed max-width or use responsive max-width
- Use
w-fullto ensure content uses full available width - Test sidebar collapse to verify content expansion
Container Padding Standards
Standard Patterns
Pattern 1: Responsive Padding (Recommended)Anti-Patterns to Avoid
❌ Double Padding:Vertical Spacing
Standard Patterns
Between Sections: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:- Mobile:
p-4(16px) - Prevents cramped cards - Tablet+:
p-6(24px) - Comfortable spacing - Avoid
p-6on mobile (too large)
Dialog Size Tiers
Use only these standard tiers forDialogContent. 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 forSheetContent. 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
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:- 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:Table Spacing
Standard Patterns
Table Padding:- Mobile:
12px(p-3) - Desktop:
16px(md:p-4) - Header Height: Mobile
40px(h-10), Desktop48px(md:h-12)
Section Headers
Standard Patterns
Standard Section Header: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-6withPageContainer - Replace
space-y-6withspace-y-4 md:space-y-6 - Replace
gap-4/gap-6withgap-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:- Check for fixed-width elements: Remove
w-{fixed}classes - Use responsive grid:
grid-cols-1 md:grid-cols-2 - Check container: Ensure
PageContaineris used, not manual padding - 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)
- Content expansion when sidebar collapses
- Container padding consistency
- Responsive spacing patterns
- Mobile-first design
- Dead space elimination
Related Documents
- 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