ux-toolkit 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +137 -0
- package/agents/accessibility-auditor.md +39 -0
- package/agents/accessibility-engineer.md +43 -0
- package/agents/interaction-reviewer.md +47 -0
- package/agents/ux-auditor.md +52 -0
- package/agents/ux-engineer.md +40 -0
- package/agents/visual-reviewer.md +41 -0
- package/commands/a11y-check.md +14 -0
- package/commands/design-review.md +14 -0
- package/commands/screenshot-review.md +15 -0
- package/commands/ux-audit.md +15 -0
- package/dist/cli.js +295 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.cjs +254 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +88 -0
- package/dist/index.d.ts +88 -0
- package/dist/index.js +220 -0
- package/dist/index.js.map +1 -0
- package/package.json +71 -0
- package/skills/interaction-patterns/SKILL.md +258 -0
- package/skills/mobile-responsive-ux/SKILL.md +260 -0
- package/skills/react-ux-patterns/SKILL.md +335 -0
- package/skills/ux-heuristics/SKILL.md +150 -0
- package/skills/visual-design-system/SKILL.md +208 -0
- package/skills/wcag-accessibility/SKILL.md +178 -0
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: react-ux-patterns
|
|
3
|
+
description: React and Next.js specific UX patterns including state management, data fetching, and component patterns
|
|
4
|
+
license: MIT
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# React UX Best Practices
|
|
8
|
+
|
|
9
|
+
## Loading States
|
|
10
|
+
|
|
11
|
+
### Suspense Pattern
|
|
12
|
+
```tsx
|
|
13
|
+
import { Suspense } from 'react';
|
|
14
|
+
|
|
15
|
+
<Suspense fallback={<Skeleton />}>
|
|
16
|
+
<DataComponent />
|
|
17
|
+
</Suspense>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Query Hook Pattern
|
|
21
|
+
```tsx
|
|
22
|
+
const { data, isLoading, error } = useQuery({
|
|
23
|
+
queryKey: ['items'],
|
|
24
|
+
queryFn: fetchItems,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
if (isLoading) return <Skeleton />;
|
|
28
|
+
if (error) return <ErrorState error={error} onRetry={refetch} />;
|
|
29
|
+
return <ItemList items={data} />;
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Deferred Loading
|
|
33
|
+
```tsx
|
|
34
|
+
import { useDeferredValue } from 'react';
|
|
35
|
+
|
|
36
|
+
function SearchResults({ query }) {
|
|
37
|
+
const deferredQuery = useDeferredValue(query);
|
|
38
|
+
const isStale = query !== deferredQuery;
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<div style={{ opacity: isStale ? 0.7 : 1 }}>
|
|
42
|
+
<Results query={deferredQuery} />
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Form Patterns
|
|
49
|
+
|
|
50
|
+
### Controlled Form with Validation
|
|
51
|
+
```tsx
|
|
52
|
+
import { useForm } from 'react-hook-form';
|
|
53
|
+
|
|
54
|
+
function ContactForm() {
|
|
55
|
+
const {
|
|
56
|
+
register,
|
|
57
|
+
handleSubmit,
|
|
58
|
+
formState: { errors, isSubmitting }
|
|
59
|
+
} = useForm();
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<form onSubmit={handleSubmit(onSubmit)}>
|
|
63
|
+
<label htmlFor="email">Email</label>
|
|
64
|
+
<input
|
|
65
|
+
id="email"
|
|
66
|
+
type="email"
|
|
67
|
+
aria-invalid={errors.email ? 'true' : 'false'}
|
|
68
|
+
aria-describedby={errors.email ? 'email-error' : undefined}
|
|
69
|
+
{...register('email', {
|
|
70
|
+
required: 'Email is required',
|
|
71
|
+
pattern: {
|
|
72
|
+
value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
|
|
73
|
+
message: 'Invalid email address'
|
|
74
|
+
}
|
|
75
|
+
})}
|
|
76
|
+
/>
|
|
77
|
+
{errors.email && (
|
|
78
|
+
<span id="email-error" role="alert">
|
|
79
|
+
{errors.email.message}
|
|
80
|
+
</span>
|
|
81
|
+
)}
|
|
82
|
+
|
|
83
|
+
<button type="submit" disabled={isSubmitting}>
|
|
84
|
+
{isSubmitting ? 'Sending...' : 'Submit'}
|
|
85
|
+
</button>
|
|
86
|
+
</form>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Validation Timing
|
|
92
|
+
| Event | Use Case |
|
|
93
|
+
|-------|----------|
|
|
94
|
+
| onChange | Real-time feedback (debounce 300ms+) |
|
|
95
|
+
| onBlur | Field-level validation on exit |
|
|
96
|
+
| onSubmit | Final validation before submission |
|
|
97
|
+
|
|
98
|
+
## Optimistic Updates
|
|
99
|
+
|
|
100
|
+
### With React Query
|
|
101
|
+
```tsx
|
|
102
|
+
const mutation = useMutation({
|
|
103
|
+
mutationFn: updateItem,
|
|
104
|
+
onMutate: async (newData) => {
|
|
105
|
+
await queryClient.cancelQueries({ queryKey: ['items'] });
|
|
106
|
+
const previous = queryClient.getQueryData(['items']);
|
|
107
|
+
|
|
108
|
+
queryClient.setQueryData(['items'], (old) =>
|
|
109
|
+
old.map((item) =>
|
|
110
|
+
item.id === newData.id ? { ...item, ...newData } : item
|
|
111
|
+
)
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
return { previous };
|
|
115
|
+
},
|
|
116
|
+
onError: (err, newData, context) => {
|
|
117
|
+
queryClient.setQueryData(['items'], context.previous);
|
|
118
|
+
toast.error('Failed to update');
|
|
119
|
+
},
|
|
120
|
+
onSettled: () => {
|
|
121
|
+
queryClient.invalidateQueries({ queryKey: ['items'] });
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Use Cases for Optimistic UI
|
|
127
|
+
- Toggle states (like, bookmark, follow)
|
|
128
|
+
- Simple text edits
|
|
129
|
+
- Reordering items
|
|
130
|
+
- Adding/removing from lists
|
|
131
|
+
|
|
132
|
+
### Avoid Optimistic UI When
|
|
133
|
+
- Complex server validation required
|
|
134
|
+
- Financial transactions
|
|
135
|
+
- Irreversible actions
|
|
136
|
+
- Multi-step processes
|
|
137
|
+
|
|
138
|
+
## Focus Management
|
|
139
|
+
|
|
140
|
+
### Modal Focus Trap
|
|
141
|
+
```tsx
|
|
142
|
+
import { useRef, useEffect } from 'react';
|
|
143
|
+
|
|
144
|
+
function Modal({ isOpen, onClose, children }) {
|
|
145
|
+
const modalRef = useRef(null);
|
|
146
|
+
const previousFocus = useRef(null);
|
|
147
|
+
|
|
148
|
+
useEffect(() => {
|
|
149
|
+
if (isOpen) {
|
|
150
|
+
previousFocus.current = document.activeElement;
|
|
151
|
+
modalRef.current?.focus();
|
|
152
|
+
}
|
|
153
|
+
return () => {
|
|
154
|
+
previousFocus.current?.focus();
|
|
155
|
+
};
|
|
156
|
+
}, [isOpen]);
|
|
157
|
+
|
|
158
|
+
return isOpen ? (
|
|
159
|
+
<div
|
|
160
|
+
ref={modalRef}
|
|
161
|
+
role="dialog"
|
|
162
|
+
aria-modal="true"
|
|
163
|
+
tabIndex={-1}
|
|
164
|
+
onKeyDown={(e) => e.key === 'Escape' && onClose()}
|
|
165
|
+
>
|
|
166
|
+
{children}
|
|
167
|
+
</div>
|
|
168
|
+
) : null;
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Skip Link
|
|
173
|
+
```tsx
|
|
174
|
+
function SkipLink() {
|
|
175
|
+
return (
|
|
176
|
+
<a
|
|
177
|
+
href="#main-content"
|
|
178
|
+
className="sr-only focus:not-sr-only focus:absolute focus:top-4 focus:left-4"
|
|
179
|
+
>
|
|
180
|
+
Skip to main content
|
|
181
|
+
</a>
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Announcements for Screen Readers
|
|
187
|
+
|
|
188
|
+
### Live Region Hook
|
|
189
|
+
```tsx
|
|
190
|
+
import { useState, useCallback } from 'react';
|
|
191
|
+
|
|
192
|
+
function useAnnounce() {
|
|
193
|
+
const [message, setMessage] = useState('');
|
|
194
|
+
|
|
195
|
+
const announce = useCallback((text, priority = 'polite') => {
|
|
196
|
+
setMessage('');
|
|
197
|
+
setTimeout(() => setMessage(text), 100);
|
|
198
|
+
}, []);
|
|
199
|
+
|
|
200
|
+
const Announcer = () => (
|
|
201
|
+
<div
|
|
202
|
+
role="status"
|
|
203
|
+
aria-live="polite"
|
|
204
|
+
aria-atomic="true"
|
|
205
|
+
className="sr-only"
|
|
206
|
+
>
|
|
207
|
+
{message}
|
|
208
|
+
</div>
|
|
209
|
+
);
|
|
210
|
+
|
|
211
|
+
return { announce, Announcer };
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Error Boundaries
|
|
216
|
+
|
|
217
|
+
### Functional Error Boundary
|
|
218
|
+
```tsx
|
|
219
|
+
import { ErrorBoundary } from 'react-error-boundary';
|
|
220
|
+
|
|
221
|
+
function ErrorFallback({ error, resetErrorBoundary }) {
|
|
222
|
+
return (
|
|
223
|
+
<div role="alert">
|
|
224
|
+
<h2>Something went wrong</h2>
|
|
225
|
+
<pre>{error.message}</pre>
|
|
226
|
+
<button onClick={resetErrorBoundary}>Try again</button>
|
|
227
|
+
</div>
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
<ErrorBoundary
|
|
232
|
+
FallbackComponent={ErrorFallback}
|
|
233
|
+
onReset={() => queryClient.clear()}
|
|
234
|
+
>
|
|
235
|
+
<App />
|
|
236
|
+
</ErrorBoundary>
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Performance UX
|
|
240
|
+
|
|
241
|
+
### Code Splitting
|
|
242
|
+
```tsx
|
|
243
|
+
import { lazy, Suspense } from 'react';
|
|
244
|
+
|
|
245
|
+
const HeavyComponent = lazy(() => import('./HeavyComponent'));
|
|
246
|
+
|
|
247
|
+
function App() {
|
|
248
|
+
return (
|
|
249
|
+
<Suspense fallback={<Skeleton />}>
|
|
250
|
+
<HeavyComponent />
|
|
251
|
+
</Suspense>
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Image Optimization (Next.js)
|
|
257
|
+
```tsx
|
|
258
|
+
import Image from 'next/image';
|
|
259
|
+
|
|
260
|
+
<Image
|
|
261
|
+
src="/hero.jpg"
|
|
262
|
+
alt="Hero image description"
|
|
263
|
+
width={1200}
|
|
264
|
+
height={600}
|
|
265
|
+
priority={isAboveFold}
|
|
266
|
+
placeholder="blur"
|
|
267
|
+
blurDataURL={blurPlaceholder}
|
|
268
|
+
/>
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### Virtualization for Long Lists
|
|
272
|
+
```tsx
|
|
273
|
+
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
274
|
+
|
|
275
|
+
function VirtualList({ items }) {
|
|
276
|
+
const parentRef = useRef(null);
|
|
277
|
+
|
|
278
|
+
const virtualizer = useVirtualizer({
|
|
279
|
+
count: items.length,
|
|
280
|
+
getScrollElement: () => parentRef.current,
|
|
281
|
+
estimateSize: () => 50,
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
return (
|
|
285
|
+
<div ref={parentRef} style={{ height: '400px', overflow: 'auto' }}>
|
|
286
|
+
<div style={{ height: virtualizer.getTotalSize() }}>
|
|
287
|
+
{virtualizer.getVirtualItems().map((virtualRow) => (
|
|
288
|
+
<div
|
|
289
|
+
key={virtualRow.key}
|
|
290
|
+
style={{
|
|
291
|
+
position: 'absolute',
|
|
292
|
+
top: virtualRow.start,
|
|
293
|
+
height: virtualRow.size,
|
|
294
|
+
}}
|
|
295
|
+
>
|
|
296
|
+
{items[virtualRow.index]}
|
|
297
|
+
</div>
|
|
298
|
+
))}
|
|
299
|
+
</div>
|
|
300
|
+
</div>
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
## Reduced Motion Support
|
|
306
|
+
|
|
307
|
+
```tsx
|
|
308
|
+
function AnimatedComponent() {
|
|
309
|
+
const prefersReducedMotion = useMediaQuery(
|
|
310
|
+
'(prefers-reduced-motion: reduce)'
|
|
311
|
+
);
|
|
312
|
+
|
|
313
|
+
return (
|
|
314
|
+
<motion.div
|
|
315
|
+
animate={{ x: 100 }}
|
|
316
|
+
transition={{
|
|
317
|
+
duration: prefersReducedMotion ? 0 : 0.3,
|
|
318
|
+
}}
|
|
319
|
+
/>
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### CSS Approach
|
|
325
|
+
```css
|
|
326
|
+
@media (prefers-reduced-motion: reduce) {
|
|
327
|
+
*,
|
|
328
|
+
*::before,
|
|
329
|
+
*::after {
|
|
330
|
+
animation-duration: 0.01ms !important;
|
|
331
|
+
animation-iteration-count: 1 !important;
|
|
332
|
+
transition-duration: 0.01ms !important;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
```
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ux-heuristics
|
|
3
|
+
description: Nielsen's 10 usability heuristics with evaluation methodology and severity scoring
|
|
4
|
+
license: MIT
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Usability Heuristics Evaluation
|
|
8
|
+
|
|
9
|
+
## Nielsen's 10 Heuristics
|
|
10
|
+
|
|
11
|
+
### 1. Visibility of System Status
|
|
12
|
+
Keep users informed through timely feedback.
|
|
13
|
+
|
|
14
|
+
**Check for:**
|
|
15
|
+
- Loading states and progress indicators
|
|
16
|
+
- Save/submit confirmations
|
|
17
|
+
- Error notifications
|
|
18
|
+
- Connection status indicators
|
|
19
|
+
|
|
20
|
+
**Severity if missing:** High - users feel lost without feedback
|
|
21
|
+
|
|
22
|
+
### 2. Match Between System and Real World
|
|
23
|
+
Use familiar language and follow real-world conventions.
|
|
24
|
+
|
|
25
|
+
**Check for:**
|
|
26
|
+
- User-friendly terminology (not developer jargon)
|
|
27
|
+
- Intuitive iconography
|
|
28
|
+
- Logical information ordering
|
|
29
|
+
- Cultural appropriateness
|
|
30
|
+
|
|
31
|
+
**Severity if violated:** Medium-High
|
|
32
|
+
|
|
33
|
+
### 3. User Control and Freedom
|
|
34
|
+
Provide emergency exits and undo support.
|
|
35
|
+
|
|
36
|
+
**Check for:**
|
|
37
|
+
- Cancel buttons on forms/dialogs
|
|
38
|
+
- Back navigation
|
|
39
|
+
- Undo/redo functionality
|
|
40
|
+
- Clear exit paths from workflows
|
|
41
|
+
|
|
42
|
+
**Severity if missing:** High
|
|
43
|
+
|
|
44
|
+
### 4. Consistency and Standards
|
|
45
|
+
Follow platform conventions and internal patterns.
|
|
46
|
+
|
|
47
|
+
**Check for:**
|
|
48
|
+
- Consistent button styles and placement
|
|
49
|
+
- Uniform terminology across screens
|
|
50
|
+
- Standard interaction patterns (e.g., swipe to delete)
|
|
51
|
+
- Platform-specific conventions (iOS HIG, Material Design)
|
|
52
|
+
|
|
53
|
+
**Severity if violated:** Medium-High
|
|
54
|
+
|
|
55
|
+
### 5. Error Prevention
|
|
56
|
+
Prevent problems before they occur.
|
|
57
|
+
|
|
58
|
+
**Check for:**
|
|
59
|
+
- Confirmation dialogs for destructive actions
|
|
60
|
+
- Input validation before submission
|
|
61
|
+
- Constraints that prevent invalid states
|
|
62
|
+
- Clear affordances for interactive elements
|
|
63
|
+
|
|
64
|
+
**Severity if missing:** High for destructive actions
|
|
65
|
+
|
|
66
|
+
### 6. Recognition Rather Than Recall
|
|
67
|
+
Minimize memory load by making options visible.
|
|
68
|
+
|
|
69
|
+
**Check for:**
|
|
70
|
+
- Visible navigation and options
|
|
71
|
+
- Contextual help and hints
|
|
72
|
+
- Recent items and history
|
|
73
|
+
- Autocomplete suggestions
|
|
74
|
+
|
|
75
|
+
**Severity if violated:** Medium
|
|
76
|
+
|
|
77
|
+
### 7. Flexibility and Efficiency of Use
|
|
78
|
+
Provide accelerators for expert users.
|
|
79
|
+
|
|
80
|
+
**Check for:**
|
|
81
|
+
- Keyboard shortcuts
|
|
82
|
+
- Customization options
|
|
83
|
+
- Shortcuts for frequent actions
|
|
84
|
+
- Power user features
|
|
85
|
+
|
|
86
|
+
**Severity if missing:** Low-Medium
|
|
87
|
+
|
|
88
|
+
### 8. Aesthetic and Minimalist Design
|
|
89
|
+
Remove irrelevant or rarely needed information.
|
|
90
|
+
|
|
91
|
+
**Check for:**
|
|
92
|
+
- Information density (too much? too little?)
|
|
93
|
+
- Visual clutter
|
|
94
|
+
- Clear hierarchy
|
|
95
|
+
- Purposeful use of color and typography
|
|
96
|
+
|
|
97
|
+
**Severity if violated:** Medium
|
|
98
|
+
|
|
99
|
+
### 9. Help Users Recognize, Diagnose, and Recover from Errors
|
|
100
|
+
Provide clear error messages with solutions.
|
|
101
|
+
|
|
102
|
+
**Check for:**
|
|
103
|
+
- Human-readable error messages (not error codes)
|
|
104
|
+
- Specific problem identification
|
|
105
|
+
- Actionable recovery suggestions
|
|
106
|
+
- Non-blaming tone
|
|
107
|
+
|
|
108
|
+
**Severity if violated:** High
|
|
109
|
+
|
|
110
|
+
### 10. Help and Documentation
|
|
111
|
+
Provide searchable, task-focused help.
|
|
112
|
+
|
|
113
|
+
**Check for:**
|
|
114
|
+
- Help availability (tooltips, docs, FAQs)
|
|
115
|
+
- Searchable documentation
|
|
116
|
+
- Task-oriented guidance
|
|
117
|
+
- Contextual help
|
|
118
|
+
|
|
119
|
+
**Severity if missing:** Low-Medium
|
|
120
|
+
|
|
121
|
+
## Severity Rating Scale
|
|
122
|
+
|
|
123
|
+
| Rating | Label | Description | Action |
|
|
124
|
+
|--------|-------|-------------|--------|
|
|
125
|
+
| 0 | Not a problem | No usability issue | None |
|
|
126
|
+
| 1 | Cosmetic | Minor visual issue | Fix if time permits |
|
|
127
|
+
| 2 | Minor | Causes slight confusion | Low priority |
|
|
128
|
+
| 3 | Major | Significantly impacts task completion | High priority |
|
|
129
|
+
| 4 | Catastrophic | Prevents task completion | Must fix immediately |
|
|
130
|
+
|
|
131
|
+
## Evaluation Process
|
|
132
|
+
|
|
133
|
+
1. **Identify the scope** - Which screens/flows to evaluate
|
|
134
|
+
2. **Review independently** - Evaluate each heuristic separately
|
|
135
|
+
3. **Document issues** - Note location, heuristic violated, severity
|
|
136
|
+
4. **Calculate priority** - Frequency × Severity = Priority
|
|
137
|
+
5. **Recommend fixes** - Provide specific, actionable solutions
|
|
138
|
+
|
|
139
|
+
## Output Format
|
|
140
|
+
|
|
141
|
+
For each issue found:
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
**Issue:** [Brief description]
|
|
145
|
+
**Location:** [Screen/component/flow]
|
|
146
|
+
**Heuristic:** [Number and name]
|
|
147
|
+
**Severity:** [0-4]
|
|
148
|
+
**Impact:** [How it affects users]
|
|
149
|
+
**Recommendation:** [Specific fix]
|
|
150
|
+
```
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: visual-design-system
|
|
3
|
+
description: Visual design principles including layout, typography, color theory, and spacing systems
|
|
4
|
+
license: MIT
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Visual Design System Principles
|
|
8
|
+
|
|
9
|
+
## Visual Hierarchy
|
|
10
|
+
|
|
11
|
+
Priority order: **Size > Color > Contrast > Position > Whitespace**
|
|
12
|
+
|
|
13
|
+
### Typography Scale
|
|
14
|
+
|
|
15
|
+
| Level | Size | Weight | Use |
|
|
16
|
+
|-------|------|--------|-----|
|
|
17
|
+
| Display | 48-72px | Bold | Hero headlines |
|
|
18
|
+
| H1 | 32-48px | Bold | Page titles |
|
|
19
|
+
| H2 | 24-32px | Semibold | Section headers |
|
|
20
|
+
| H3 | 20-24px | Semibold | Subsections |
|
|
21
|
+
| H4 | 18-20px | Medium | Card titles |
|
|
22
|
+
| Body | 16-18px | Regular | Content |
|
|
23
|
+
| Small | 14px | Regular | Captions, metadata |
|
|
24
|
+
| Tiny | 12px | Regular | Labels, hints |
|
|
25
|
+
|
|
26
|
+
### Typography Best Practices
|
|
27
|
+
- Line height: 1.4-1.6 for body text
|
|
28
|
+
- Line length: 50-75 characters optimal
|
|
29
|
+
- Font families: Maximum 2-3 per design
|
|
30
|
+
- Heading contrast: Darker than body text
|
|
31
|
+
|
|
32
|
+
## 8pt Grid System
|
|
33
|
+
|
|
34
|
+
Base unit: 8px (4px for fine adjustments)
|
|
35
|
+
|
|
36
|
+
| Token | Value | Use |
|
|
37
|
+
|-------|-------|-----|
|
|
38
|
+
| space-0 | 0 | Reset |
|
|
39
|
+
| space-1 | 4px | Tight spacing, icons |
|
|
40
|
+
| space-2 | 8px | Inline elements, small gaps |
|
|
41
|
+
| space-3 | 16px | Component padding |
|
|
42
|
+
| space-4 | 24px | Card padding |
|
|
43
|
+
| space-5 | 32px | Section spacing |
|
|
44
|
+
| space-6 | 48px | Large sections |
|
|
45
|
+
| space-7 | 64px | Page sections |
|
|
46
|
+
| space-8 | 96px | Hero spacing |
|
|
47
|
+
|
|
48
|
+
### Grid Alignment Checklist
|
|
49
|
+
- [ ] All spacing uses 8px increments (4px for fine tuning)
|
|
50
|
+
- [ ] Component padding is consistent
|
|
51
|
+
- [ ] Margins between sections are uniform
|
|
52
|
+
- [ ] Icons align to 4px grid
|
|
53
|
+
|
|
54
|
+
## Color System
|
|
55
|
+
|
|
56
|
+
### 60-30-10 Rule
|
|
57
|
+
- **60%** Neutral/background colors
|
|
58
|
+
- **30%** Secondary/surface colors
|
|
59
|
+
- **10%** Accent colors (CTAs, highlights)
|
|
60
|
+
|
|
61
|
+
### Semantic Color Tokens
|
|
62
|
+
|
|
63
|
+
| Token | Purpose | Example Use |
|
|
64
|
+
|-------|---------|-------------|
|
|
65
|
+
| primary | Brand, main actions | Submit buttons, links |
|
|
66
|
+
| secondary | Alternative actions | Cancel, secondary buttons |
|
|
67
|
+
| success | Positive feedback | Success messages, completed |
|
|
68
|
+
| warning | Caution states | Unsaved changes, warnings |
|
|
69
|
+
| error | Problems | Validation errors, failures |
|
|
70
|
+
| info | Neutral information | Tips, hints, help text |
|
|
71
|
+
|
|
72
|
+
### Color Contrast Requirements
|
|
73
|
+
| Use Case | Minimum Ratio | WCAG Level |
|
|
74
|
+
|----------|---------------|------------|
|
|
75
|
+
| Body text | 4.5:1 | AA |
|
|
76
|
+
| Large text (18px+) | 3:1 | AA |
|
|
77
|
+
| UI components | 3:1 | AA |
|
|
78
|
+
| Enhanced | 7:1 | AAA |
|
|
79
|
+
|
|
80
|
+
### Dark Mode Considerations
|
|
81
|
+
- Invert semantic meanings carefully
|
|
82
|
+
- Reduce pure white (#fff) to off-white
|
|
83
|
+
- Adjust shadows to glows
|
|
84
|
+
- Test contrast in both modes
|
|
85
|
+
|
|
86
|
+
## Layout Patterns
|
|
87
|
+
|
|
88
|
+
### Common Layouts
|
|
89
|
+
|
|
90
|
+
**F-Pattern**
|
|
91
|
+
- Best for: Text-heavy content
|
|
92
|
+
- Eye movement: Left to right, then down left side
|
|
93
|
+
- Place important content along the F
|
|
94
|
+
|
|
95
|
+
**Z-Pattern**
|
|
96
|
+
- Best for: Landing pages, minimal content
|
|
97
|
+
- Eye movement: Top left → top right → bottom left → bottom right
|
|
98
|
+
- Place CTA at end of Z
|
|
99
|
+
|
|
100
|
+
**Card Grid**
|
|
101
|
+
- Best for: Content collections, dashboards
|
|
102
|
+
- Use consistent card sizes
|
|
103
|
+
- Maintain gutters between cards
|
|
104
|
+
|
|
105
|
+
**Split Screen**
|
|
106
|
+
- Best for: Comparisons, form + preview
|
|
107
|
+
- Balance visual weight
|
|
108
|
+
- Consider responsive behavior
|
|
109
|
+
|
|
110
|
+
### Container Widths
|
|
111
|
+
| Size | Max Width | Use |
|
|
112
|
+
|------|-----------|-----|
|
|
113
|
+
| xs | 320px | Mobile narrow |
|
|
114
|
+
| sm | 540px | Mobile |
|
|
115
|
+
| md | 720px | Tablet |
|
|
116
|
+
| lg | 960px | Desktop |
|
|
117
|
+
| xl | 1140px | Large desktop |
|
|
118
|
+
| 2xl | 1320px | Extra large |
|
|
119
|
+
| full | 100% | Full bleed |
|
|
120
|
+
|
|
121
|
+
## Responsive Design
|
|
122
|
+
|
|
123
|
+
### Breakpoints
|
|
124
|
+
| Name | Width | Typical Device |
|
|
125
|
+
|------|-------|----------------|
|
|
126
|
+
| xs | <576px | Phone portrait |
|
|
127
|
+
| sm | ≥576px | Phone landscape |
|
|
128
|
+
| md | ≥768px | Tablet |
|
|
129
|
+
| lg | ≥992px | Desktop |
|
|
130
|
+
| xl | ≥1200px | Large desktop |
|
|
131
|
+
| 2xl | ≥1400px | Extra large |
|
|
132
|
+
|
|
133
|
+
### Mobile-First CSS
|
|
134
|
+
```css
|
|
135
|
+
.element {
|
|
136
|
+
padding: 16px;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
@media (min-width: 768px) {
|
|
140
|
+
.element {
|
|
141
|
+
padding: 24px;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@media (min-width: 1024px) {
|
|
146
|
+
.element {
|
|
147
|
+
padding: 32px;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Gestalt Principles
|
|
153
|
+
|
|
154
|
+
### Proximity
|
|
155
|
+
Elements close together are perceived as related.
|
|
156
|
+
- Group related controls
|
|
157
|
+
- Add space between unrelated items
|
|
158
|
+
- Use whitespace to create sections
|
|
159
|
+
|
|
160
|
+
### Similarity
|
|
161
|
+
Similar elements are perceived as related.
|
|
162
|
+
- Use consistent styling for similar functions
|
|
163
|
+
- Differentiate distinct element types
|
|
164
|
+
- Color, shape, size signal relationships
|
|
165
|
+
|
|
166
|
+
### Continuity
|
|
167
|
+
Elements arranged in a line are perceived as related.
|
|
168
|
+
- Align elements along invisible lines
|
|
169
|
+
- Use consistent alignment throughout
|
|
170
|
+
- Guide the eye with visual flow
|
|
171
|
+
|
|
172
|
+
### Closure
|
|
173
|
+
The mind fills in gaps to complete shapes.
|
|
174
|
+
- Incomplete elements can suggest meaning
|
|
175
|
+
- Icons don't need full outlines
|
|
176
|
+
- Whitespace can define boundaries
|
|
177
|
+
|
|
178
|
+
## Design Review Checklist
|
|
179
|
+
|
|
180
|
+
### Visual Hierarchy
|
|
181
|
+
- [ ] Clear primary focal point
|
|
182
|
+
- [ ] Logical reading order
|
|
183
|
+
- [ ] Consistent heading levels
|
|
184
|
+
- [ ] Appropriate text sizes
|
|
185
|
+
|
|
186
|
+
### Spacing
|
|
187
|
+
- [ ] Consistent padding within components
|
|
188
|
+
- [ ] Consistent margins between sections
|
|
189
|
+
- [ ] Adequate whitespace for breathing room
|
|
190
|
+
- [ ] Touch targets ≥44px on mobile
|
|
191
|
+
|
|
192
|
+
### Color
|
|
193
|
+
- [ ] Follows 60-30-10 rule
|
|
194
|
+
- [ ] Semantic colors used appropriately
|
|
195
|
+
- [ ] Sufficient contrast ratios
|
|
196
|
+
- [ ] Works in dark mode (if applicable)
|
|
197
|
+
|
|
198
|
+
### Typography
|
|
199
|
+
- [ ] Readable font sizes
|
|
200
|
+
- [ ] Appropriate line height
|
|
201
|
+
- [ ] Good line length (50-75 chars)
|
|
202
|
+
- [ ] Limited font families (2-3 max)
|
|
203
|
+
|
|
204
|
+
### Alignment
|
|
205
|
+
- [ ] Elements aligned to grid
|
|
206
|
+
- [ ] Consistent left/center/right alignment
|
|
207
|
+
- [ ] Visual balance across page
|
|
208
|
+
- [ ] No orphaned elements
|