Design Fundamentals
Purpose
Create distinctive, beautiful UIs through intentional aesthetic choices backed by solid technical foundation.
Design Thinking
Choose Aesthetic Direction
Before coding, commit to clear aesthetic tone:
Minimal/Refined:
- Generous whitespace, restrained color palette
- Elegant serif or geometric sans-serif fonts
- Subtle interactions, high contrast
Bold/Vibrant:
- Saturated colors, strong contrasts
- Display fonts with personality
- Energetic interactions, dynamic layouts
Playful/Friendly:
- Rounded shapes, warm color palette
- Approachable fonts, comfortable spacing
- Delightful micro-interactions
Retro/Nostalgic:
- Period-specific typography
- Vintage color schemes, textured backgrounds
Organic/Natural:
- Earthy tones, soft shapes, flowing layouts
- Natural imagery, gentle transitions
Principle: Intentionality > intensity. Commit fully to chosen direction.
Avoid Generic AI Aesthetics
Never use these clichés:
❌ Purple gradients on white backgrounds
❌ System fonts everywhere (Inter, Roboto, Arial)
❌ Predictable 12-column grid layouts
❌ Safe, evenly-distributed color palettes
❌ Cookie-cutter card layouts
❌ Rounded corners on everything
Instead, be distinctive:
✅ Choose beautiful, characterful fonts
✅ Commit to bold colors OR refined neutrals
✅ Create unexpected layouts (asymmetry, overlap, diagonal flow)
✅ Use dominant colors with sharp accents
✅ Add visual details (textures, gradients, patterns, depth)
✅ Break the grid intentionally
Technical Foundation
Spacing System
Principle: Consistent scale creates visual rhythm and professionalism.
Choose ONE base unit and multiply:
- Smaller base (4): Finer control, granular spacing
- Larger base (8): Simpler system, bolder spacing
Build your scale:
- Start with base unit (4, 6, 8, or whatever fits)
- Create scale: base × 1, 2, 3, 4, 6, 8, 12, 16, 24
- Stick to scale values (avoid arbitrary in-between values)
Guidelines:
- Tighter spacing for related items
- Generous spacing separates major sections
- Whitespace = breathing room and importance
- Choose scale matching your aesthetic
Typography
Creative Direction:
- Choose distinctive, characterful fonts (not system fonts)
- Pair display font (headings) with refined body font
- Font conveys personality: geometric = modern, serif = elegant, rounded = friendly
- Avoid overused fonts: Inter, Roboto, Arial, Helvetica
Technical Specs:
- Body text: Readable size (typically 16px+, adjust based on font)
- Line height: 1.5-1.6 for body, 1.2-1.3 for headings
- Line length: 50-75 characters optimal
- Type scale: Choose ratio for consistent hierarchy
- Subtle/refined: Smaller ratio (1.2)
- Balanced: Medium ratio (1.25)
- Bold/dramatic: Larger ratio (1.333+)
Font Weights:
- Regular (400): Body text
- Semibold (600): Emphasis, subheadings
- Bold (700): Headings, strong emphasis
- Limit to 3-4 weights maximum
Hierarchy Levels:
- Primary: Page titles, main CTAs
- Secondary: Section headings, important actions
- Tertiary: Body text, labels
- Quaternary: Metadata, captions, helper text
Color System
Creative Direction:
- Commit to aesthetic: bold OR refined (not timid middle)
- Use dominant colors with sharp accents
- Color conveys mood: warm (energy), cool (calm), muted (sophistication)
- Consider color psychology for brand personality
Technical Specs:
- Primary: Main brand color for CTAs, key actions (1 color)
- Neutrals: Text, borders, backgrounds (5-7 shades from light to dark)
- Semantic: Success (green), error (red), warning (yellow), info (blue)
- Limit: 3-4 brand colors maximum
Contrast Requirements (WCAG AA - required for accessibility):
- Normal text: 4.5:1 minimum
- Large text: 3:1 minimum
- UI components: 3:1 minimum
- Use contrast checker tools to verify
Guidelines:
- Test all text/background combinations
- Don't rely on color alone (add icons, labels, patterns)
- Each color needs light/dark variants
Visual Hierarchy
Principle: Guide attention through size, weight, contrast, and spacing.
Create clear levels:
- Use size differences (headings larger than body)
- Use weight differences (bold for emphasis)
- Use spacing (more space = more importance)
- Use color sparingly for hierarchy
Hierarchy Techniques:
- Size: Primary elements significantly larger (2-3x+ size difference)
- Proximity: Group related items close, separate groups with generous space
- Contrast: Important elements use stronger contrast
- Alignment: Consistent alignment creates order
Spatial Composition
Layout Patterns
Create interest through:
- Asymmetry: Break symmetry for dynamic feel
- Overlap: Layer elements for depth
- Diagonal flow: Guide eye with angled layouts
- Whitespace: Generous negative space OR controlled density (intentional)
- Grid breaking: Intentionally break grid for emphasis
Alignment:
- Left-align text for readability (LTR languages)
- Center-align sparingly (titles, empty states)
- Right-align numbers in tables
- Be consistent within sections
Accessibility Essentials
Apply to every UI component — not optional.
Semantic HTML First
<button> for actions, <a> for navigation — never <div> with click handler
- Headings
<h1>→<h6> in order, don't skip levels
- Landmarks:
<nav>, <main>, <header>, <footer>
Focus
- Never remove focus outline — use
:focus-visible to hide for mouse, show for keyboard
- Minimum 2px outline, 3:1 contrast ratio
- Modals: move focus in on open, trap inside, return to trigger on close, Escape closes
ARIA (use only when semantic HTML insufficient)
- Icon-only buttons:
aria-label="Close"
- Toggles/dropdowns:
aria-expanded="true/false"
- Dynamic content (toasts, errors):
aria-live="polite" or "assertive" for urgent
- Error fields:
aria-invalid="true" + aria-describedby pointing to error message
Touch Targets
- Minimum 44×44px for all interactive elements
- 8px spacing between targets
Visual Details
Add Depth and Atmosphere
Backgrounds:
- Gradient meshes (soft, blended colors)
- Noise textures (subtle grain, paper texture)
- Geometric patterns (shapes, grids, dots)
- Layered transparencies (depth through layers)
Details:
- Shadows for elevation (subtle for cards, stronger for modals)
- Borders for definition (thin, subtle color difference)
- Subtle animations (hover states, quick transitions)
Validation Checklist
Creative:
Technical:
Key Takeaway
Distinctive + Correct = Beautiful UI
Technical correctness (spacing, contrast, hierarchy) ensures usability and professionalism.
Creative direction (aesthetic, fonts, colors, layouts) ensures memorability and distinctiveness.
Great design requires both: intentional aesthetic choices executed with technical precision.
Focus on intentionality - commit fully to chosen direction, then execute with consistency.
Avoid generic AI aesthetics through bold or refined choices, never timid middle ground.
1---2name: frontend-design-fundamentals3description: |4 Base design skill for ALL frontend/UI work: spacing, typography, colors, visual hierarchy.5 Use when: any frontend/UI task — styling, CSS, components, layouts, animations.6 Keywords: frontend, UI, CSS, styling, layout, spacing, typography, card, button, form, dashboard, animation, hover, shadow7 Do NOT use for: backend, DevOps, React performance (→ react-best-practices).8---910# Design Fundamentals1112## Purpose13Create distinctive, beautiful UIs through intentional aesthetic choices backed by solid technical foundation.1415---1617## Design Thinking1819### Choose Aesthetic Direction2021**Before coding, commit to clear aesthetic tone:**2223**Minimal/Refined:**24- Generous whitespace, restrained color palette25- Elegant serif or geometric sans-serif fonts26- Subtle interactions, high contrast2728**Bold/Vibrant:**29- Saturated colors, strong contrasts30- Display fonts with personality31- Energetic interactions, dynamic layouts3233**Playful/Friendly:**34- Rounded shapes, warm color palette35- Approachable fonts, comfortable spacing36- Delightful micro-interactions3738**Retro/Nostalgic:**39- Period-specific typography40- Vintage color schemes, textured backgrounds4142**Organic/Natural:**43- Earthy tones, soft shapes, flowing layouts44- Natural imagery, gentle transitions4546**Principle:** Intentionality > intensity. Commit fully to chosen direction.4748---4950### Avoid Generic AI Aesthetics5152**Never use these clichés:**5354❌ Purple gradients on white backgrounds55❌ System fonts everywhere (Inter, Roboto, Arial)56❌ Predictable 12-column grid layouts57❌ Safe, evenly-distributed color palettes58❌ Cookie-cutter card layouts59❌ Rounded corners on everything6061**Instead, be distinctive:**6263✅ Choose beautiful, characterful fonts64✅ Commit to bold colors OR refined neutrals65✅ Create unexpected layouts (asymmetry, overlap, diagonal flow)66✅ Use dominant colors with sharp accents67✅ Add visual details (textures, gradients, patterns, depth)68✅ Break the grid intentionally6970---7172## Technical Foundation7374### Spacing System7576**Principle:** Consistent scale creates visual rhythm and professionalism.7778**Choose ONE base unit and multiply:**79- Smaller base (4): Finer control, granular spacing80- Larger base (8): Simpler system, bolder spacing8182**Build your scale:**83- Start with base unit (4, 6, 8, or whatever fits)84- Create scale: base × 1, 2, 3, 4, 6, 8, 12, 16, 2485- Stick to scale values (avoid arbitrary in-between values)8687**Guidelines:**88- Tighter spacing for related items89- Generous spacing separates major sections90- Whitespace = breathing room and importance91- Choose scale matching your aesthetic9293---9495### Typography9697**Creative Direction:**98- Choose distinctive, characterful fonts (not system fonts)99- Pair display font (headings) with refined body font100- Font conveys personality: geometric = modern, serif = elegant, rounded = friendly101- Avoid overused fonts: Inter, Roboto, Arial, Helvetica102103**Technical Specs:**104- **Body text**: Readable size (typically 16px+, adjust based on font)105- **Line height**: 1.5-1.6 for body, 1.2-1.3 for headings106- **Line length**: 50-75 characters optimal107- **Type scale**: Choose ratio for consistent hierarchy108 - Subtle/refined: Smaller ratio (1.2)109 - Balanced: Medium ratio (1.25)110 - Bold/dramatic: Larger ratio (1.333+)111112**Font Weights:**113- Regular (400): Body text114- Semibold (600): Emphasis, subheadings115- Bold (700): Headings, strong emphasis116- Limit to 3-4 weights maximum117118**Hierarchy Levels:**119- Primary: Page titles, main CTAs120- Secondary: Section headings, important actions121- Tertiary: Body text, labels122- Quaternary: Metadata, captions, helper text123124---125126### Color System127128**Creative Direction:**129- Commit to aesthetic: bold OR refined (not timid middle)130- Use dominant colors with sharp accents131- Color conveys mood: warm (energy), cool (calm), muted (sophistication)132- Consider color psychology for brand personality133134**Technical Specs:**135- **Primary**: Main brand color for CTAs, key actions (1 color)136- **Neutrals**: Text, borders, backgrounds (5-7 shades from light to dark)137- **Semantic**: Success (green), error (red), warning (yellow), info (blue)138- **Limit**: 3-4 brand colors maximum139140**Contrast Requirements (WCAG AA - required for accessibility):**141- Normal text: 4.5:1 minimum142- Large text: 3:1 minimum143- UI components: 3:1 minimum144- Use contrast checker tools to verify145146**Guidelines:**147- Test all text/background combinations148- Don't rely on color alone (add icons, labels, patterns)149- Each color needs light/dark variants150151---152153### Visual Hierarchy154155**Principle:** Guide attention through size, weight, contrast, and spacing.156157**Create clear levels:**158- Use size differences (headings larger than body)159- Use weight differences (bold for emphasis)160- Use spacing (more space = more importance)161- Use color sparingly for hierarchy162163**Hierarchy Techniques:**164- **Size**: Primary elements significantly larger (2-3x+ size difference)165- **Proximity**: Group related items close, separate groups with generous space166- **Contrast**: Important elements use stronger contrast167- **Alignment**: Consistent alignment creates order168169---170171## Spatial Composition172173### Layout Patterns174175**Create interest through:**176- **Asymmetry**: Break symmetry for dynamic feel177- **Overlap**: Layer elements for depth178- **Diagonal flow**: Guide eye with angled layouts179- **Whitespace**: Generous negative space OR controlled density (intentional)180- **Grid breaking**: Intentionally break grid for emphasis181182**Alignment:**183- Left-align text for readability (LTR languages)184- Center-align sparingly (titles, empty states)185- Right-align numbers in tables186- Be consistent within sections187188---189190## Accessibility Essentials191192**Apply to every UI component — not optional.**193194### Semantic HTML First195- `<button>` for actions, `<a>` for navigation — never `<div>` with click handler196- Headings `<h1>`→`<h6>` in order, don't skip levels197- Landmarks: `<nav>`, `<main>`, `<header>`, `<footer>`198199### Focus200- Never remove focus outline — use `:focus-visible` to hide for mouse, show for keyboard201- Minimum 2px outline, 3:1 contrast ratio202- **Modals**: move focus in on open, trap inside, return to trigger on close, Escape closes203204### ARIA (use only when semantic HTML insufficient)205- Icon-only buttons: `aria-label="Close"`206- Toggles/dropdowns: `aria-expanded="true/false"`207- Dynamic content (toasts, errors): `aria-live="polite"` or `"assertive"` for urgent208- Error fields: `aria-invalid="true"` + `aria-describedby` pointing to error message209210### Touch Targets211- Minimum 44×44px for all interactive elements212- 8px spacing between targets213214---215216## Visual Details217218### Add Depth and Atmosphere219220**Backgrounds:**221- Gradient meshes (soft, blended colors)222- Noise textures (subtle grain, paper texture)223- Geometric patterns (shapes, grids, dots)224- Layered transparencies (depth through layers)225226**Details:**227- Shadows for elevation (subtle for cards, stronger for modals)228- Borders for definition (thin, subtle color difference)229- Subtle animations (hover states, quick transitions)230231---232233## Validation Checklist234235**Creative:**236- [ ] Clear aesthetic direction chosen237- [ ] Distinctive, characterful fonts (not generic)238- [ ] Cohesive color palette (bold OR refined)239- [ ] Unexpected layouts or intentional grid breaks240- [ ] Visual details add atmosphere241242**Technical:**243- [ ] Spacing follows consistent scale244- [ ] Font sizes use type scale245- [ ] Color contrast meets WCAG AA (verify with checker)246- [ ] Line length readable247- [ ] Visual hierarchy clear248- [ ] Alignment consistent and intentional249- [ ] Limited brand color palette250251---252253## Key Takeaway254255**Distinctive + Correct = Beautiful UI**256257Technical correctness (spacing, contrast, hierarchy) ensures usability and professionalism.258Creative direction (aesthetic, fonts, colors, layouts) ensures memorability and distinctiveness.259260Great design requires both: intentional aesthetic choices executed with technical precision.261262Focus on intentionality - commit fully to chosen direction, then execute with consistency.263Avoid generic AI aesthetics through bold or refined choices, never timid middle ground.