1---2name: ui3description: Design clear, consistent, and visually polished user interfaces.4---5
6## Visual Hierarchy
7
8- One focal point per screen—eye knows where to go first
9- Size, color, weight establish importance—primary action most prominent
10- Group related elements—proximity implies relationship
11- White space is not wasted space—breathing room aids scanning
12
13## Typography
14
15- Maximum 2-3 font families—more creates visual noise
16- Clear size scale: title > heading > body > caption—distinct steps, not gradual
17- Line height 1.4-1.6 for body text—too tight or loose hurts readability
18- Line length 45-75 characters—prevents eye fatigue
19- Left-align body text—centered only for short headings
20
21## Color Usage
22
23- Primary color for primary actions—one dominant brand color
24- Semantic colors consistent: red=error, green=success, yellow=warning
25- Don't rely on color alone—add icons, text, patterns for accessibility
26- Neutral palette for most UI—color for emphasis, not everywhere
27- Test color blindness scenarios—8% of men affected
28
29## Spacing System
30
31- Use consistent scale: 4px, 8px, 16px, 24px, 32px, 48px
32- Apply same spacing for same relationships—all card padding equal
33- More space around groups than within—visual grouping through proximity
34- Generous padding on touch targets—44px minimum for mobile
35
36## Alignment
37
38- Grid system for consistency—8px or 4px base grid
39- Align to invisible lines—elements share edges, not scattered
40- Left edge strongest for LTR—anchor content predictably
41- Optical alignment when needed—visual center differs from mathematical
42
43## Component States
44
45- Default, hover, active, focus, disabled—all states designed
46- Focus state visible and clear—keyboard users need this
47- Disabled looks disabled—reduced opacity, no pointer cursor
48- Loading state replaces content—not just overlay
49- Error state in context—red border, inline message
50
51## Icons
52
53- Consistent style throughout—don't mix outlined and filled
54- Recognizable at small sizes—simple shapes work better
55- Labels when meaning ambiguous—icon + text clearer than icon alone
56- Touch target larger than visual icon—44px tap area, 24px icon
57
58## Imagery
59
60- Consistent aspect ratios—don't stretch or skew
61- Fallback for failed loads—placeholder, not broken image
62- Alt text for content images—decorative images alt=""
63- Compress appropriately—quality vs file size balance
64
65## Responsive Design
66
67- Design for smallest screen first—enhance for larger
68- Breakpoints based on content—not arbitrary device widths
69- Touch targets larger on touch screens—hover states only on desktop
70- Consider landscape orientation—especially for tablets
71
72## Dark Mode
73
74- Not just color inversion—redesign depth and emphasis
75- Reduce contrast slightly—pure white on black strains eyes
76- Shadows don't work same—use lighter surfaces for elevation
77- Test all states—errors, success, charts, images
78- Respect system preference—but allow override
79
80## Motion and Animation
81
82- Duration 150-300ms for transitions—fast but perceptible
83- Ease-out for entering—starts fast, settles in
84- Ease-in for exiting—accelerates out of view
85- Consistent timing across similar interactions
86- Purpose: guide attention, show relationships, provide feedback
87
88## Design Tokens
89
90- Define tokens for colors, spacing, typography—single source of truth
91- Semantic naming: `color-error` not `color-red`
92- Enables theming and dark mode—swap token values
93- Scales with product—change once, update everywhere
94
95## Common Mistakes
96
97- Too many font sizes—stick to the scale
98- Inconsistent spacing—creates unpolished feel
99- Low contrast text—4.5:1 minimum for accessibility
100- Buttons that don't look clickable—affordance matters
101- Different styles for same component—cards should match cards