Frontend Design (UI/UX for Developers)
Practical UI/UX guidance with strict best-practice enforcement for responsive, accessible interfaces.
When to Use Me
Use me when:
- Building user interfaces (web, mobile, desktop)
- Designing forms, dashboards, landing pages
- Implementing responsive layouts
- Adding animations or micro-interactions
- Reviewing UI for accessibility issues
- Creating component states (loading, error, empty)
- Setting up design systems
Do not use me for:
- Backend architecture
- Database design
- API development
- Business logic implementation
Non-Negotiable Enforcement Rules
For restyling/design tasks, these rules are mandatory:
- Mobile-first is required: build 375px base first, then enhance with breakpoints.
- All domain checks must pass: mobile, typography, hierarchy, states, forms, interaction, animation, accessibility.
- Final deep scan is required: run domain-by-domain validation and patch gaps before final output.
- No partial completion: if a domain fails, iterate until all critical checks pass.
Workflow (Best-Practice Enforcement)
Analyze requirements
- Identify product type and constraints from
references/product-recommendations.csv
- Determine primary user action and success metric
Apply mobile-first (VERPLICHT)
- Start with mobile base (375px), no desktop-first classes
- Enforce touch targets >= 44x44 and >= 8px spacing
- Place primary actions in thumb-friendly zones
Apply typography system
- Max 2 fonts
- Consistent type scale and heading/body contrast
- Body text min 16px, readable line height
Apply visual hierarchy
- Prioritize with size -> color -> weight -> position
- Keep clear scanning order (headline, key value, CTA, details)
Enhance for larger screens
- Add
sm:, md:, lg:, xl: progressively
- Validate on 375, 768, 1024, and 1440 widths
Implement component and form states
- Component states: default, hover, focus, active, disabled, loading, error, success
- Form UX: visible labels, field-level errors, correct input types, submit feedback
Review interaction patterns
- Apply Fitts's Law (target size/proximity)
- Apply Hick's Law (limit choices)
- Add explicit feedback timing for user actions
Apply motion safely
- Use short, purposeful motion
- Animate transform/opacity only
- Respect reduced-motion preferences
Check accessibility (WCAG 2.1 AA)
- Contrast >= 4.5:1 for normal text
- Visible focus states and keyboard reachability
- ARIA labels where needed
- No color-only meaning
Run deep scan and iterate
- Run the domain checklist below
- Fix all failed items
- Re-scan until zero critical failures
Domain Gate Checklist (Must Pass)
| Domain |
Mandatory Checks |
Reference |
| Mobile UX |
375px base first, touch >= 44x44, spacing >= 8px, thumb-friendly actions, no desktop-first |
references/mobile-ux.md |
| Typography |
Max 2 fonts, min 16px body text, readable line-height, stable type scale |
references/typography.md |
| Visual Hierarchy |
Size/color/weight/position priorities are clear |
references/visual-hierarchy.md |
| Component States |
default/hover/focus/active/disabled/loading/error/success all covered |
references/component-states.md |
| Forms UX |
Visible labels, input types, validation timing, field-level errors, submit feedback |
references/forms-ux.md |
| Interaction Patterns |
Fitts + Hick + error prevention + timed feedback |
references/interaction-patterns.md |
| Animation |
<= 300ms UI motion, transform/opacity only, reduced-motion support |
references/animation.md |
| Accessibility |
WCAG contrast, focus visibility, ARIA naming, keyboard flow, no color-only signals |
references/contrast-accessibility.md |
| UX Guidelines |
Resolve any high-severity conflicts before final output |
references/ux-guidelines.csv |
| Product Fit |
Style direction aligns with product type and context |
references/product-recommendations.csv |
If any row fails, do not finalize. Fix and re-run the checklist.
Quick Reference
Component States Checklist
Every interactive component needs:
| State |
Visual |
Code Example |
| Default |
Normal appearance |
class="btn" |
| Hover |
Subtle feedback |
hover:bg-gray-100 |
| Focus |
Visible ring (a11y) |
focus:ring-2 focus:ring-blue-500 |
| Active |
Pressed feedback |
active:scale-95 |
| Disabled |
Reduced opacity |
opacity-50 cursor-not-allowed |
| Loading |
Spinner + disabled |
disabled spinner |
| Error |
Red border + message |
border-red-500 text-red-600 |
| Success |
Positive confirmation |
text-green-700 border-green-300 |
Touch Targets
- Minimum size: 44x44px
- Minimum gap: 8px between targets
- Code:
min-h-[44px] min-w-[44px]
Typography Quick Rules
| Element |
Size |
Weight |
Line Height |
| H1 |
32-48px |
Bold |
1.2-1.3 |
| H2 |
24-32px |
Semibold |
1.3-1.4 |
| Body |
16px |
Regular |
1.5-1.6 |
| Small |
12-14px |
Regular |
1.4-1.5 |
| Minimum |
12px |
- |
- |
- Max fonts: 2 families
- Line length: 65-75ch desktop, 30-40ch mobile
Color Accessibility
- Normal text: 4.5:1 contrast ratio minimum
- Large text: 3:1 contrast ratio minimum
- Never rely on color alone - add icons or text
Mobile-First Checklist
Bij elke styling taak:
| Check |
Voorbeeld |
| ✅ Base = mobile (375px) |
flex flex-col gap-4 p-4 |
| ✅ Enhance met breakpoints |
md:flex-row md:gap-8 |
| ✅ Touch targets ≥ 44px |
min-h-[44px] min-w-[44px] |
| ✅ Primary actions bottom |
Fixed bottom nav |
| ❌ No desktop-first |
Niet lg: als basis |
Motion Checklist
- UI motion meestal <= 300ms
- Alleen
transform en opacity animeren
prefers-reduced-motion respecteren
- Geen decoratieve oneindige animaties
Mobile-First Regel (Altijd Toepassen)
❌ FOUT: Desktop first, dan "fixen" voor mobile
class="flex-row gap-8 p-8 md:flex-col md:gap-4 md:p-4"
✅ GOED: Mobile base, enhance voor desktop
class="flex flex-col gap-4 p-4 md:flex-row md:gap-8 md:p-8"
Tailwind volgorde: base styles (mobile) → sm: (640px) → md: (768px) → lg: (1024px) → xl: (1280px)
Key Principles
1. Mobile-First (VERPLICHT)
Bij ELKE styling of restyling taak: begin met mobile (375px), enhance voor grotere schermen.
Dit is niet optioneel - mobile-first zorgt voor:
- Betere performance (minder CSS op mobile)
- Betere UX (meest beperkte scherm eerst)
- Eenvoudigere code (additive, niet subtractive)
<!-- ❌ FOUT: Desktop first -->
<div class="flex-row gap-8 p-8 md:flex-col md:gap-4 md:p-4"></div>
<!-- ✅ GOED: Mobile first -->
<div class="flex flex-col gap-4 p-4 md:flex-row md:gap-8 md:p-8"></div>
Zie: references/mobile-ux.md voor complete mobile patterns.
2. Typography Before Decoration
Text clarity comes before ornamental style:
- Body text stays readable on mobile (>= 16px)
- Heading scale is consistent
- No more than 2 font families
- Paragraph width remains scannable
3. Visual Hierarchy
Guide user attention through:
- Size: Larger = more important
- Color: Darker/vibrant = more attention
- Weight: Bolder = stands out
- Position: Top/center = noticed first
4. Feedback
Every action needs response:
- Immediate: Button press, hover state
- Progress: Loading spinners, skeletons
- Completion: Success toasts, checkmarks
- Failure: Error messages with recovery
5. Accessibility (WCAG 2.1)
Non-negotiable requirements:
- All images have
alt text
- All inputs have labels
- All interactive elements have focus states
- Color contrast meets 4.5:1 minimum
- Never convey info by color alone
- Respect reduced-motion settings
Common Patterns
Form UX
✓ Label above input
✓ Error below input
✓ Inline validation on blur
✓ Show/hide password toggle
✓ Appropriate input types (email, tel, number)
✓ Required field indicators
✓ Submit feedback (loading + success/error)
Loading States
✓ Skeleton screens for content
✓ Spinners for actions
✓ Progress bars for multi-step
✓ Disable buttons during submission
✓ Reduced-motion fallback
Empty States
✓ Clear message explaining why empty
✓ Actionable CTA to fix it
✓ Helpful tips or suggestions
✓ Maintain brand personality
✓ Focusable CTA for keyboard users
Error Handling
✓ Clear message what went wrong
✓ Actionable solution
✓ Preserve user input
✓ Don't blame the user
✓ Announce critical errors (`role="alert"`)
Anti-Patterns to Avoid
| Don't |
Do Instead |
| Remove focus outlines |
Add custom focus styles |
| Use placeholder as label |
Always show visible label |
| Auto-play video/audio |
Click-to-play only |
| Infinite animations |
Animate on interaction |
| Generic "Error occurred" |
Specific error with solution |
| Disable zoom |
Never disable user zoom |
| Fixed 100vh on mobile |
Use min-h-dvh |
| More than 2 fonts |
Keep typography system simple |
| Animate width/height |
Animate transform/opacity |
Design Workflow Example: Card Component Restyling
Een praktisch voorbeeld van hoe je een component restyled met mobile-first aanpak.
Scenario
Opdracht: Restyle een simpele ProductCard naar een moderne DashboardCard
Before (Desktop-first, verouderd):
<div class="w-80 h-48 p-6 border rounded shadow-lg flex-row gap-4">
<img class="w-32 h-32 object-cover" src="product.jpg" />
<div class="flex-1">
<h3 class="text-xl font-bold mb-2">Product Naam</h3>
<p class="text-gray-600 mb-4">Omschrijving...</p>
<button class="bg-blue-500 text-white px-4 py-2 rounded">Bekijk</button>
</div>
</div>
Problemen:
- ❌ Desktop-first (w-80, flex-row als basis)
- ❌ Geen responsive breakpoints
- ❌ Touch target te klein (py-2 < 44px)
- ❌ Geen states (hover, focus, loading)
- ❌ Geen accessibility (geen alt, geen focus ring)
Stap 1: Mobile Base (375px)
Start met de kleinste schermgrootte. Verticale layout, full-width, voldoende touch targets.
<!-- Mobile base - altijd eerst! -->
<article class="p-4 border rounded-lg">
<img
class="w-full h-40 object-cover rounded"
src="product.jpg"
alt="Product afbeelding"
/>
<h3 class="mt-3 text-lg font-semibold">Product Naam</h3>
<p class="mt-2 text-sm text-gray-600 line-clamp-2">Omschrijving...</p>
<button
class="mt-4 w-full min-h-[44px] bg-blue-500 text-white rounded font-medium"
>
Bekijk details
</button>
</article>
Toegevoegd:
- ✅
alt voor accessibility
- ✅
min-h-[44px] voor touch target
- ✅
line-clamp-2 voor tekst truncation
- ✅ Verticale layout (mobile default)
Stap 2: Tablet Enhancement (768px+)
Voeg md: breakpoints toe. NIET vervangen, alleen uitbreiden.
<article class="p-4 md:p-6 border rounded-lg md:flex md:gap-4">
<img
class="w-full h-40 object-cover rounded md:w-48 md:h-auto md:flex-shrink-0"
src="product.jpg"
alt="Product afbeelding"
/>
<div class="mt-3 md:mt-0 md:flex-1 md:flex md:flex-col">
<h3 class="text-lg font-semibold md:text-xl">Product Naam</h3>
<p class="mt-2 text-sm text-gray-600 line-clamp-2 md:line-clamp-3">
Omschrijving...
</p>
<div class="mt-auto pt-4">
<button
class="w-full min-h-[44px] bg-blue-500 text-white rounded font-medium md:w-auto md:px-6"
>
Bekijk details
</button>
</div>
</div>
</article>
Toegevoegd:
- ✅
md:flex md:gap-4 - horizontale layout
- ✅
md:w-48 - vaste afbeelding breedte
- ✅
md:flex-1 md:flex md:flex-col - content vult ruimte
- ✅
mt-auto - button naar beneden duwen
Stap 3: Desktop Enhancement (1024px+)
Extra polish voor grotere schermen.
<article
class="
p-4 md:p-6 lg:p-8
border rounded-lg
md:flex md:gap-4 lg:gap-6
hover:shadow-lg transition-shadow
focus-within:ring-2 focus-within:ring-blue-500
"
>
<img
class="w-full h-40 object-cover rounded md:w-48 lg:w-56 md:h-auto md:flex-shrink-0"
src="product.jpg"
alt="Product afbeelding"
loading="lazy"
/>
<div class="mt-3 md:mt-0 md:flex-1 md:flex md:flex-col">
<h3 class="text-lg font-semibold md:text-xl lg:text-2xl">Product Naam</h3>
<p class="mt-2 text-sm text-gray-600 line-clamp-2 md:line-clamp-3">
Omschrijving...
</p>
<div class="mt-auto pt-4">
<button
class="
w-full min-h-[44px]
bg-blue-500 text-white rounded font-medium
md:w-auto md:px-6
hover:bg-blue-600 active:bg-blue-700
focus:ring-2 focus:ring-blue-500 focus:ring-offset-2
transition-colors
"
>
Bekijk details
</button>
</div>
</div>
</article>
Toegevoegd:
- ✅
lg: spacing enhancement
- ✅
hover:shadow-lg - card interactie
- ✅
focus-within:ring - accessibility
- ✅
loading="lazy" - performance
- ✅ Button states:
hover:, active:, focus:
Stap 4: States Toevoegen
Alle states voor interactieve elementen.
<!-- Loading state -->
<article class="p-4 md:p-6 border rounded-lg animate-pulse">
<div class="w-full h-40 bg-gray-200 rounded md:w-48"></div>
<div class="mt-3 h-6 bg-gray-200 rounded w-3/4"></div>
<div class="mt-2 h-4 bg-gray-200 rounded w-full"></div>
<div class="mt-4 h-11 bg-gray-200 rounded"></div>
</article>
<!-- Error state -->
<article class="p-4 md:p-6 border border-red-200 rounded-lg bg-red-50">
<div class="flex items-center gap-3 text-red-600">
<svg class="w-8 h-8" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
/>
</svg>
<div>
<h3 class="font-semibold">Kon product niet laden</h3>
<button class="text-sm underline hover:no-underline">
Opnieuw proberen
</button>
</div>
</div>
</article>
<!-- Disabled + success action states -->
<div class="flex gap-3 mt-4">
<button class="min-h-[44px] px-4 rounded bg-gray-300 text-gray-600" disabled>
Laden...
</button>
<button
class="min-h-[44px] px-4 rounded bg-green-600 text-white hover:bg-green-700 focus:ring-2 focus:ring-green-500"
>
Opgeslagen
</button>
</div>
Stap 5: Validatie Checklist
| Check |
Status |
| ✅ Mobile base (375px) |
Voltooid |
| ✅ Touch targets ≥ 44px |
min-h-[44px] |
| ✅ Responsive breakpoints |
md: en lg: |
| ✅ Alle states |
default, hover, active, focus, disabled, loading, error, success |
| ✅ Accessibility |
alt, focus:ring, semantic HTML |
| ✅ Performance |
loading="lazy", geen onnodige animaties |
| ✅ Reduced motion |
motion-reduce:* of media query |
Samenvatting Workflow
| Stap |
Wat |
Check |
| 1 |
Mobile base (375px) |
Basis styling zonder breakpoints |
| 2 |
Tablet (768px+) |
md: toevoegen, niet vervangen |
| 3 |
Desktop (1024px+) |
lg: voor extra polish |
| 4 |
States |
Hover, focus, active, loading, error |
| 5 |
Validate |
Alle checks doorlopen |
Deep Scan Template (Use Before Final Answer)
Run this scan after every restyle/design response:
- Mobile UX: no desktop-first defaults, touch >= 44px, breakpoint progression valid
- Typography: body >= 16px, type scale coherent, max 2 fonts
- States: interactive states + loading + error + success present
- Forms (if present): labels, field errors, input types, submit feedback
- Animation: <= 300ms for UI, transform/opacity only, reduced-motion support
- Accessibility: contrast, focus visibility, ARIA labels, keyboard reachability
- Interaction: clear feedback timing, no dead-end errors, no hidden critical actions
- Product fit: style choice aligns with product type and domain constraints
If any item fails, patch and re-scan. Finalize only when all critical checks pass.
References
For detailed guidance on specific topics:
- references/visual-hierarchy.md - Size, color, weight, position
- references/contrast-accessibility.md - WCAG compliance, ARIA
- references/typography.md - Font selection, sizing, line height
- references/interaction-patterns.md - Fitts's Law, Hick's Law
- references/component-states.md - All states checklist
- references/forms-ux.md - Form design patterns
- references/mobile-ux.md - Touch targets, thumb zone
- references/animation.md - Micro-interactions, reduced motion
- references/ux-guidelines.csv - 99 actionable guidelines
- references/product-recommendations.csv - Style by product type
1---2name: frontend-design3description: UI/UX design principles for developers - visual hierarchy, spacing, contrast, accessibility (WCAG), component states, interaction patterns, forms, mobile UX. Use for design decisions and UX guidance. For Tailwind CSS use tailwind skill. For shadcn components use shadcn-svelte skill.4license: MIT5---67# Frontend Design (UI/UX for Developers)89Practical UI/UX guidance with strict best-practice enforcement for responsive, accessible interfaces.1011## When to Use Me1213Use me when:1415- Building user interfaces (web, mobile, desktop)16- Designing forms, dashboards, landing pages17- Implementing responsive layouts18- Adding animations or micro-interactions19- Reviewing UI for accessibility issues20- Creating component states (loading, error, empty)21- Setting up design systems2223Do not use me for:2425- Backend architecture26- Database design27- API development28- Business logic implementation2930---3132## Non-Negotiable Enforcement Rules3334For restyling/design tasks, these rules are mandatory:35361. **Mobile-first is required**: build 375px base first, then enhance with breakpoints.372. **All domain checks must pass**: mobile, typography, hierarchy, states, forms, interaction, animation, accessibility.383. **Final deep scan is required**: run domain-by-domain validation and patch gaps before final output.394. **No partial completion**: if a domain fails, iterate until all critical checks pass.4041---4243## Workflow (Best-Practice Enforcement)44451. **Analyze requirements**46 - Identify product type and constraints from `references/product-recommendations.csv`47 - Determine primary user action and success metric48492. **Apply mobile-first (VERPLICHT)**50 - Start with mobile base (375px), no desktop-first classes51 - Enforce touch targets >= 44x44 and >= 8px spacing52 - Place primary actions in thumb-friendly zones53543. **Apply typography system**55 - Max 2 fonts56 - Consistent type scale and heading/body contrast57 - Body text min 16px, readable line height58594. **Apply visual hierarchy**60 - Prioritize with size -> color -> weight -> position61 - Keep clear scanning order (headline, key value, CTA, details)62635. **Enhance for larger screens**64 - Add `sm:`, `md:`, `lg:`, `xl:` progressively65 - Validate on 375, 768, 1024, and 1440 widths66676. **Implement component and form states**68 - Component states: default, hover, focus, active, disabled, loading, error, success69 - Form UX: visible labels, field-level errors, correct input types, submit feedback70717. **Review interaction patterns**72 - Apply Fitts's Law (target size/proximity)73 - Apply Hick's Law (limit choices)74 - Add explicit feedback timing for user actions75768. **Apply motion safely**77 - Use short, purposeful motion78 - Animate transform/opacity only79 - Respect reduced-motion preferences80819. **Check accessibility (WCAG 2.1 AA)**82 - Contrast >= 4.5:1 for normal text83 - Visible focus states and keyboard reachability84 - ARIA labels where needed85 - No color-only meaning868710. **Run deep scan and iterate**88 - Run the domain checklist below89 - Fix all failed items90 - Re-scan until zero critical failures9192---9394## Domain Gate Checklist (Must Pass)9596| Domain | Mandatory Checks | Reference |97| -------------------- | ------------------------------------------------------------------------------------------ | ---------------------------------------- |98| Mobile UX | 375px base first, touch >= 44x44, spacing >= 8px, thumb-friendly actions, no desktop-first | `references/mobile-ux.md` |99| Typography | Max 2 fonts, min 16px body text, readable line-height, stable type scale | `references/typography.md` |100| Visual Hierarchy | Size/color/weight/position priorities are clear | `references/visual-hierarchy.md` |101| Component States | default/hover/focus/active/disabled/loading/error/success all covered | `references/component-states.md` |102| Forms UX | Visible labels, input types, validation timing, field-level errors, submit feedback | `references/forms-ux.md` |103| Interaction Patterns | Fitts + Hick + error prevention + timed feedback | `references/interaction-patterns.md` |104| Animation | <= 300ms UI motion, transform/opacity only, reduced-motion support | `references/animation.md` |105| Accessibility | WCAG contrast, focus visibility, ARIA naming, keyboard flow, no color-only signals | `references/contrast-accessibility.md` |106| UX Guidelines | Resolve any high-severity conflicts before final output | `references/ux-guidelines.csv` |107| Product Fit | Style direction aligns with product type and context | `references/product-recommendations.csv` |108109If any row fails, do not finalize. Fix and re-run the checklist.110111---112113## Quick Reference114115### Component States Checklist116117Every interactive component needs:118119| State | Visual | Code Example |120| ------------ | --------------------- | ---------------------------------- |121| **Default** | Normal appearance | `class="btn"` |122| **Hover** | Subtle feedback | `hover:bg-gray-100` |123| **Focus** | Visible ring (a11y) | `focus:ring-2 focus:ring-blue-500` |124| **Active** | Pressed feedback | `active:scale-95` |125| **Disabled** | Reduced opacity | `opacity-50 cursor-not-allowed` |126| **Loading** | Spinner + disabled | `disabled spinner` |127| **Error** | Red border + message | `border-red-500 text-red-600` |128| **Success** | Positive confirmation | `text-green-700 border-green-300` |129130### Touch Targets131132- **Minimum size**: 44x44px133- **Minimum gap**: 8px between targets134- **Code**: `min-h-[44px] min-w-[44px]`135136### Typography Quick Rules137138| Element | Size | Weight | Line Height |139| ------- | ------- | -------- | ----------- |140| H1 | 32-48px | Bold | 1.2-1.3 |141| H2 | 24-32px | Semibold | 1.3-1.4 |142| Body | 16px | Regular | 1.5-1.6 |143| Small | 12-14px | Regular | 1.4-1.5 |144| Minimum | 12px | - | - |145146- **Max fonts**: 2 families147- **Line length**: 65-75ch desktop, 30-40ch mobile148149### Color Accessibility150151- **Normal text**: 4.5:1 contrast ratio minimum152- **Large text**: 3:1 contrast ratio minimum153- **Never rely on color alone** - add icons or text154155### Mobile-First Checklist156157Bij elke styling taak:158159| Check | Voorbeeld |160| -------------------------- | --------------------------- |161| ✅ Base = mobile (375px) | `flex flex-col gap-4 p-4` |162| ✅ Enhance met breakpoints | `md:flex-row md:gap-8` |163| ✅ Touch targets ≥ 44px | `min-h-[44px] min-w-[44px]` |164| ✅ Primary actions bottom | Fixed bottom nav |165| ❌ No desktop-first | Niet `lg:` als basis |166167### Motion Checklist168169- UI motion meestal <= 300ms170- Alleen `transform` en `opacity` animeren171- `prefers-reduced-motion` respecteren172- Geen decoratieve oneindige animaties173174---175176### Mobile-First Regel (Altijd Toepassen)177178```179❌ FOUT: Desktop first, dan "fixen" voor mobile180 class="flex-row gap-8 p-8 md:flex-col md:gap-4 md:p-4"181182✅ GOED: Mobile base, enhance voor desktop183 class="flex flex-col gap-4 p-4 md:flex-row md:gap-8 md:p-8"184```185186**Tailwind volgorde**: base styles (mobile) → `sm:` (640px) → `md:` (768px) → `lg:` (1024px) → `xl:` (1280px)187188---189190## Key Principles191192### 1. Mobile-First (VERPLICHT)193194**Bij ELKE styling of restyling taak: begin met mobile (375px), enhance voor grotere schermen.**195196Dit is niet optioneel - mobile-first zorgt voor:197198- Betere performance (minder CSS op mobile)199- Betere UX (meest beperkte scherm eerst)200- Eenvoudigere code (additive, niet subtractive)201202```html203<!-- ❌ FOUT: Desktop first -->204<div class="flex-row gap-8 p-8 md:flex-col md:gap-4 md:p-4"></div>205206<!-- ✅ GOED: Mobile first -->207<div class="flex flex-col gap-4 p-4 md:flex-row md:gap-8 md:p-8"></div>208```209210**Zie**: `references/mobile-ux.md` voor complete mobile patterns.211212### 2. Typography Before Decoration213214Text clarity comes before ornamental style:215216- Body text stays readable on mobile (>= 16px)217- Heading scale is consistent218- No more than 2 font families219- Paragraph width remains scannable220221### 3. Visual Hierarchy222223Guide user attention through:224225- **Size**: Larger = more important226- **Color**: Darker/vibrant = more attention227- **Weight**: Bolder = stands out228- **Position**: Top/center = noticed first229230### 4. Feedback231232Every action needs response:233234- **Immediate**: Button press, hover state235- **Progress**: Loading spinners, skeletons236- **Completion**: Success toasts, checkmarks237- **Failure**: Error messages with recovery238239### 5. Accessibility (WCAG 2.1)240241Non-negotiable requirements:242243- All images have `alt` text244- All inputs have labels245- All interactive elements have focus states246- Color contrast meets 4.5:1 minimum247- Never convey info by color alone248- Respect reduced-motion settings249250---251252## Common Patterns253254### Form UX255256```257✓ Label above input258✓ Error below input259✓ Inline validation on blur260✓ Show/hide password toggle261✓ Appropriate input types (email, tel, number)262✓ Required field indicators263✓ Submit feedback (loading + success/error)264```265266### Loading States267268```269✓ Skeleton screens for content270✓ Spinners for actions271✓ Progress bars for multi-step272✓ Disable buttons during submission273✓ Reduced-motion fallback274```275276### Empty States277278```279✓ Clear message explaining why empty280✓ Actionable CTA to fix it281✓ Helpful tips or suggestions282✓ Maintain brand personality283✓ Focusable CTA for keyboard users284```285286### Error Handling287288```289✓ Clear message what went wrong290✓ Actionable solution291✓ Preserve user input292✓ Don't blame the user293✓ Announce critical errors (`role="alert"`)294```295296---297298## Anti-Patterns to Avoid299300| Don't | Do Instead |301| ------------------------ | ----------------------------- |302| Remove focus outlines | Add custom focus styles |303| Use placeholder as label | Always show visible label |304| Auto-play video/audio | Click-to-play only |305| Infinite animations | Animate on interaction |306| Generic "Error occurred" | Specific error with solution |307| Disable zoom | Never disable user zoom |308| Fixed 100vh on mobile | Use `min-h-dvh` |309| More than 2 fonts | Keep typography system simple |310| Animate width/height | Animate transform/opacity |311312---313314## Design Workflow Example: Card Component Restyling315316Een praktisch voorbeeld van hoe je een component restyled met mobile-first aanpak.317318### Scenario319320**Opdracht**: Restyle een simpele ProductCard naar een moderne DashboardCard321322**Before (Desktop-first, verouderd)**:323324```html325<div class="w-80 h-48 p-6 border rounded shadow-lg flex-row gap-4">326 <img class="w-32 h-32 object-cover" src="product.jpg" />327 <div class="flex-1">328 <h3 class="text-xl font-bold mb-2">Product Naam</h3>329 <p class="text-gray-600 mb-4">Omschrijving...</p>330 <button class="bg-blue-500 text-white px-4 py-2 rounded">Bekijk</button>331 </div>332</div>333```334335**Problemen**:336337- ❌ Desktop-first (w-80, flex-row als basis)338- ❌ Geen responsive breakpoints339- ❌ Touch target te klein (py-2 < 44px)340- ❌ Geen states (hover, focus, loading)341- ❌ Geen accessibility (geen alt, geen focus ring)342343---344345### Stap 1: Mobile Base (375px)346347Start met de kleinste schermgrootte. Verticale layout, full-width, voldoende touch targets.348349```html350<!-- Mobile base - altijd eerst! -->351<article class="p-4 border rounded-lg">352 <img353 class="w-full h-40 object-cover rounded"354 src="product.jpg"355 alt="Product afbeelding"356 />357 <h3 class="mt-3 text-lg font-semibold">Product Naam</h3>358 <p class="mt-2 text-sm text-gray-600 line-clamp-2">Omschrijving...</p>359 <button360 class="mt-4 w-full min-h-[44px] bg-blue-500 text-white rounded font-medium"361 >362 Bekijk details363 </button>364</article>365```366367**Toegevoegd**:368369- ✅ `alt` voor accessibility370- ✅ `min-h-[44px]` voor touch target371- ✅ `line-clamp-2` voor tekst truncation372- ✅ Verticale layout (mobile default)373374---375376### Stap 2: Tablet Enhancement (768px+)377378Voeg `md:` breakpoints toe. NIET vervangen, alleen uitbreiden.379380```html381<article class="p-4 md:p-6 border rounded-lg md:flex md:gap-4">382 <img383 class="w-full h-40 object-cover rounded md:w-48 md:h-auto md:flex-shrink-0"384 src="product.jpg"385 alt="Product afbeelding"386 />387 <div class="mt-3 md:mt-0 md:flex-1 md:flex md:flex-col">388 <h3 class="text-lg font-semibold md:text-xl">Product Naam</h3>389 <p class="mt-2 text-sm text-gray-600 line-clamp-2 md:line-clamp-3">390 Omschrijving...391 </p>392 <div class="mt-auto pt-4">393 <button394 class="w-full min-h-[44px] bg-blue-500 text-white rounded font-medium md:w-auto md:px-6"395 >396 Bekijk details397 </button>398 </div>399 </div>400</article>401```402403**Toegevoegd**:404405- ✅ `md:flex md:gap-4` - horizontale layout406- ✅ `md:w-48` - vaste afbeelding breedte407- ✅ `md:flex-1 md:flex md:flex-col` - content vult ruimte408- ✅ `mt-auto` - button naar beneden duwen409410---411412### Stap 3: Desktop Enhancement (1024px+)413414Extra polish voor grotere schermen.415416```html417<article418 class="419 p-4 md:p-6 lg:p-8420 border rounded-lg 421 md:flex md:gap-4 lg:gap-6422 hover:shadow-lg transition-shadow423 focus-within:ring-2 focus-within:ring-blue-500424"425>426 <img427 class="w-full h-40 object-cover rounded md:w-48 lg:w-56 md:h-auto md:flex-shrink-0"428 src="product.jpg"429 alt="Product afbeelding"430 loading="lazy"431 />432 <div class="mt-3 md:mt-0 md:flex-1 md:flex md:flex-col">433 <h3 class="text-lg font-semibold md:text-xl lg:text-2xl">Product Naam</h3>434 <p class="mt-2 text-sm text-gray-600 line-clamp-2 md:line-clamp-3">435 Omschrijving...436 </p>437 <div class="mt-auto pt-4">438 <button439 class="440 w-full min-h-[44px] 441 bg-blue-500 text-white rounded font-medium 442 md:w-auto md:px-6443 hover:bg-blue-600 active:bg-blue-700444 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2445 transition-colors446 "447 >448 Bekijk details449 </button>450 </div>451 </div>452</article>453```454455**Toegevoegd**:456457- ✅ `lg:` spacing enhancement458- ✅ `hover:shadow-lg` - card interactie459- ✅ `focus-within:ring` - accessibility460- ✅ `loading="lazy"` - performance461- ✅ Button states: `hover:`, `active:`, `focus:`462463---464465### Stap 4: States Toevoegen466467Alle states voor interactieve elementen.468469```html470<!-- Loading state -->471<article class="p-4 md:p-6 border rounded-lg animate-pulse">472 <div class="w-full h-40 bg-gray-200 rounded md:w-48"></div>473 <div class="mt-3 h-6 bg-gray-200 rounded w-3/4"></div>474 <div class="mt-2 h-4 bg-gray-200 rounded w-full"></div>475 <div class="mt-4 h-11 bg-gray-200 rounded"></div>476</article>477478<!-- Error state -->479<article class="p-4 md:p-6 border border-red-200 rounded-lg bg-red-50">480 <div class="flex items-center gap-3 text-red-600">481 <svg class="w-8 h-8" fill="none" viewBox="0 0 24 24" stroke="currentColor">482 <path483 stroke-linecap="round"484 stroke-linejoin="round"485 stroke-width="2"486 d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"487 />488 </svg>489 <div>490 <h3 class="font-semibold">Kon product niet laden</h3>491 <button class="text-sm underline hover:no-underline">492 Opnieuw proberen493 </button>494 </div>495 </div>496</article>497498<!-- Disabled + success action states -->499<div class="flex gap-3 mt-4">500 <button class="min-h-[44px] px-4 rounded bg-gray-300 text-gray-600" disabled>501 Laden...502 </button>503 <button504 class="min-h-[44px] px-4 rounded bg-green-600 text-white hover:bg-green-700 focus:ring-2 focus:ring-green-500"505 >506 Opgeslagen507 </button>508</div>509```510511---512513### Stap 5: Validatie Checklist514515| Check | Status |516| ------------------------- | ---------------------------------------------------------------- |517| ✅ Mobile base (375px) | Voltooid |518| ✅ Touch targets ≥ 44px | `min-h-[44px]` |519| ✅ Responsive breakpoints | `md:` en `lg:` |520| ✅ Alle states | default, hover, active, focus, disabled, loading, error, success |521| ✅ Accessibility | `alt`, `focus:ring`, semantic HTML |522| ✅ Performance | `loading="lazy"`, geen onnodige animaties |523| ✅ Reduced motion | `motion-reduce:*` of media query |524525---526527### Samenvatting Workflow528529| Stap | Wat | Check |530| ----- | ------------------- | ------------------------------------ |531| **1** | Mobile base (375px) | Basis styling zonder breakpoints |532| **2** | Tablet (768px+) | `md:` toevoegen, niet vervangen |533| **3** | Desktop (1024px+) | `lg:` voor extra polish |534| **4** | States | Hover, focus, active, loading, error |535| **5** | Validate | Alle checks doorlopen |536537---538539## Deep Scan Template (Use Before Final Answer)540541Run this scan after every restyle/design response:5425431. **Mobile UX**: no desktop-first defaults, touch >= 44px, breakpoint progression valid5442. **Typography**: body >= 16px, type scale coherent, max 2 fonts5453. **States**: interactive states + loading + error + success present5464. **Forms** (if present): labels, field errors, input types, submit feedback5475. **Animation**: <= 300ms for UI, transform/opacity only, reduced-motion support5486. **Accessibility**: contrast, focus visibility, ARIA labels, keyboard reachability5497. **Interaction**: clear feedback timing, no dead-end errors, no hidden critical actions5508. **Product fit**: style choice aligns with product type and domain constraints551552If any item fails, patch and re-scan. Finalize only when all critical checks pass.553554---555556## References557558For detailed guidance on specific topics:559560- **references/visual-hierarchy.md** - Size, color, weight, position561- **references/contrast-accessibility.md** - WCAG compliance, ARIA562- **references/typography.md** - Font selection, sizing, line height563- **references/interaction-patterns.md** - Fitts's Law, Hick's Law564- **references/component-states.md** - All states checklist565- **references/forms-ux.md** - Form design patterns566- **references/mobile-ux.md** - Touch targets, thumb zone567- **references/animation.md** - Micro-interactions, reduced motion568- **references/ux-guidelines.csv** - 99 actionable guidelines569- **references/product-recommendations.csv** - Style by product type