mobileui-os 1.0.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/AGENTS.md +47 -0
- package/CHANGELOG.md +25 -0
- package/README.md +78 -0
- package/bin/cli.mjs +375 -0
- package/knowledge/android/00-apple-to-android-adaption.md +1499 -0
- package/knowledge/android/accessibility.md +333 -0
- package/knowledge/android/components-controls.md +270 -0
- package/knowledge/android/material-design-3.md +174 -0
- package/knowledge/android/navigation-patterns.md +212 -0
- package/knowledge/apple/00-skill-reading-protocol.md +1296 -0
- package/knowledge/apple/Accessibility, Inclusive Design & Human Factors Intelligence.md +735 -0
- package/knowledge/apple/Advanced Interaction Patterns, Gestures, Feedback & State Transitions.md +1140 -0
- package/knowledge/apple/Advanced Navigation, Information Architecture & Wayfinding.md +551 -0
- package/knowledge/apple/Autonomus Ui-UX Improvement Loop.md +611 -0
- package/knowledge/apple/Color, Materials, Contrast, Themes & Visual Depth.md +1351 -0
- package/knowledge/apple/Content, Copy, Microinteractions & UX Communication.md +642 -0
- package/knowledge/apple/Data-Heavy Interfaces, Tables, Lists, Search, Filtering & Large-Scale Content.md +721 -0
- package/knowledge/apple/Design Systems & Component Architecture.md +412 -0
- package/knowledge/apple/Forms, Input, Data Entry & Validation Intelligence.md +705 -0
- package/knowledge/apple/Interaction, State & Edge-Case Engineering.md +491 -0
- package/knowledge/apple/Interaction-behaviour.md +1378 -0
- package/knowledge/apple/Layout Architecture, Responsive Design & Spatial Systems.md +1365 -0
- package/knowledge/apple/MASTER UI-UX ORCHESTRATOR.md +1210 -0
- package/knowledge/apple/Navigation Architecture, Routing, Deep Linking & State Restoration.md +1392 -0
- package/knowledge/apple/Navigation, Information Architecture & Spatial Hierarchy.md +1613 -0
- package/knowledge/apple/Notifications, Permissions, Privacy and Trust.md +1540 -0
- package/knowledge/apple/Patterns-templates-composition.md +647 -0
- package/knowledge/apple/Performance, Perceived Speed, Motion & Rendering Intelligence.md +855 -0
- package/knowledge/apple/Responsive, Adaptive & Cross-Platform UI Intelligence.md +669 -0
- package/knowledge/apple/Responsive, Adaptive, Accessible & Performant UI.md +545 -0
- package/knowledge/apple/Tablet Adaptation & Multi-Device UX.md +1447 -0
- package/knowledge/apple/UI Implementation & Refactoring.md +498 -0
- package/knowledge/apple/UI-UX Decision-Making, Prioritization & Trade-offs.md +533 -0
- package/knowledge/apple/UI-UX Project Lifecycle & Delivery.md +544 -0
- package/knowledge/apple/User Flows & Experience Architecture.md +335 -0
- package/knowledge/apple/Visual Design Systems, Theming, Tokens & Brand Intelligence.md +764 -0
- package/knowledge/apple/Visual QA, Testing & Validation.md +557 -0
- package/knowledge/apple/accessibility-inclusive-interaction.md +1361 -0
- package/knowledge/apple/accessibility.md +2162 -0
- package/knowledge/apple/color.md +1933 -0
- package/knowledge/apple/component-architecture.md +2208 -0
- package/knowledge/apple/components.md +2172 -0
- package/knowledge/apple/design-decision-framework.md +1883 -0
- package/knowledge/apple/design-review-engine.md +2108 -0
- package/knowledge/apple/design-tokens.md +1943 -0
- package/knowledge/apple/designing-for-ios.md +1680 -0
- package/knowledge/apple/gestures, touch behavior, feedback, motion, and micro-interactions.md +1538 -0
- package/knowledge/apple/hig-foundation.md +1806 -0
- package/knowledge/apple/iconography.md +1903 -0
- package/knowledge/apple/interaction-patterns.md +2513 -0
- package/knowledge/apple/interaction.md +2141 -0
- package/knowledge/apple/ios-alerts-confirmations-destructive-actions.md +1342 -0
- package/knowledge/apple/ios-components-and-controls.md +1634 -0
- package/knowledge/apple/ios-components-patterns.md +1343 -0
- package/knowledge/apple/ios-design-system-architecture.md +1520 -0
- package/knowledge/apple/ios-empty-error-offline-states.md +1370 -0
- package/knowledge/apple/ios-empty-loading-error-recovery.md +1674 -0
- package/knowledge/apple/ios-forms-and-input.md +1458 -0
- package/knowledge/apple/ios-forms-input-data-entry.md +1308 -0
- package/knowledge/apple/ios-gestures-and-touch.md +1272 -0
- package/knowledge/apple/ios-lists-collections-and-data-display.md +1735 -0
- package/knowledge/apple/ios-loading-progress-async-states.md +1378 -0
- package/knowledge/apple/ios-materials-and-surfaces.md +1543 -0
- package/knowledge/apple/ios-motion-animation-transitions.md +1178 -0
- package/knowledge/apple/ios-navigation-and-information-architecture.md +1674 -0
- package/knowledge/apple/ios-navigation-user-flows-design-architecture.md +1195 -0
- package/knowledge/apple/ios-search-and-discovery.md +1456 -0
- package/knowledge/apple/ios-search-filtering-discovery.md +1402 -0
- package/knowledge/apple/ios-sheets-modals-popovers.md +1205 -0
- package/knowledge/apple/ios-typography-icons-visual-hierarchy.md +1431 -0
- package/knowledge/apple/layout.md +2331 -0
- package/knowledge/apple/media-centric-content-ui-patterns.md +1470 -0
- package/knowledge/apple/motion, transitions, physics, and animation language.md +1535 -0
- package/knowledge/apple/motion-and-animation.md +1698 -0
- package/knowledge/apple/motion.md +2087 -0
- package/knowledge/apple/navigation.md +2281 -0
- package/knowledge/apple/responsive-adaptive.md +2159 -0
- package/knowledge/apple/screen-architecture.md +2067 -0
- package/knowledge/apple/typography, Content Hierarchy & Readability.md +1411 -0
- package/knowledge/apple/typography.md +1802 -0
- package/knowledge/apple/ui-ux inteligence audit.md +106 -0
- package/knowledge/apple/visual-design-and-premium-ui.md +1555 -0
- package/knowledge/apple/visual-hierarchy-engine.md +1647 -0
- package/knowledge/apple/visual-materials.md +2189 -0
- package/package.json +53 -0
- package/principles/design-principles.md +37 -0
- package/principles/platform-principles.md +25 -0
- package/principles/ux-principles.md +16 -0
- package/references/official-links.md +11 -0
- package/skills/accessibility-engineer/SKILL.md +125 -0
- package/skills/analytics-engineer/SKILL.md +283 -0
- package/skills/animation-engineer/SKILL.md +316 -0
- package/skills/component-designer/SKILL.md +75 -0
- package/skills/component-library-engineer/SKILL.md +140 -0
- package/skills/component-library-ops/SKILL.md +155 -0
- package/skills/design-system/SKILL.md +77 -0
- package/skills/design-token-engineer/SKILL.md +203 -0
- package/skills/design-token-pipeline/SKILL.md +277 -0
- package/skills/device-lab-engineer/SKILL.md +387 -0
- package/skills/forms-engineer/SKILL.md +79 -0
- package/skills/internationalization-engineer/SKILL.md +256 -0
- package/skills/motion-designer/SKILL.md +77 -0
- package/skills/native-data-fetching/SKILL.md +50 -0
- package/skills/navigation-architect/SKILL.md +65 -0
- package/skills/performance-engineer/SKILL.md +250 -0
- package/skills/platform-specialist/SKILL.md +95 -0
- package/skills/pre-release-gate/SKILL.md +75 -0
- package/skills/screen-designer/SKILL.md +117 -0
- package/skills/security-engineer/SKILL.md +375 -0
- package/skills/skills.json +134 -0
- package/skills/testing-auditor/SKILL.md +62 -0
- package/skills/ui-architect/SKILL.md +86 -0
- package/skills/ui-implementer/SKILL.md +188 -0
- package/skills/ux-architect/SKILL.md +49 -0
- package/skills/ux-auditor/SKILL.md +52 -0
- package/skills/visual-auditor/SKILL.md +71 -0
- package/templates/audit-report.md +29 -0
- package/templates/design-tokens.ts +33 -0
- package/templates/screen-spec.md +61 -0
- package/workflows/new-screen.md +17 -0
- package/workflows/pre-release.md +21 -0
- package/workflows/redesign.md +14 -0
- package/workflows/ui-audit.md +22 -0
|
@@ -0,0 +1,2208 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
````md
|
|
4
|
+
# Apple Component Architecture Intelligence
|
|
5
|
+
|
|
6
|
+
> Agent knowledge module for designing reusable, composable, state-aware,
|
|
7
|
+
> adaptive, accessible, platform-native UI components for iOS, iPadOS,
|
|
8
|
+
> React Native, and Expo applications.
|
|
9
|
+
|
|
10
|
+
Version: 1.0
|
|
11
|
+
Platform: iOS / iPadOS / React Native / Expo
|
|
12
|
+
Role: Component architecture intelligence
|
|
13
|
+
Parent: knowledge/apple/design-tokens.md
|
|
14
|
+
Use with: MobileUI-OS
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# 1. PURPOSE
|
|
18
|
+
|
|
19
|
+
A high-quality application is not a collection of independent screens.
|
|
20
|
+
|
|
21
|
+
It is a system of reusable components.
|
|
22
|
+
|
|
23
|
+
The agent should think:
|
|
24
|
+
|
|
25
|
+
```text
|
|
26
|
+
Design Tokens
|
|
27
|
+
↓
|
|
28
|
+
Primitives
|
|
29
|
+
↓
|
|
30
|
+
Components
|
|
31
|
+
↓
|
|
32
|
+
Patterns
|
|
33
|
+
↓
|
|
34
|
+
Screens
|
|
35
|
+
↓
|
|
36
|
+
Flows
|
|
37
|
+
````
|
|
38
|
+
|
|
39
|
+
Never begin with:
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
Screen
|
|
43
|
+
↓
|
|
44
|
+
random View
|
|
45
|
+
↓
|
|
46
|
+
random styles
|
|
47
|
+
↓
|
|
48
|
+
random buttons
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
.
|
|
52
|
+
|
|
53
|
+
# 2. COMPONENT-FIRST THINKING
|
|
54
|
+
|
|
55
|
+
Before implementing a screen, identify:
|
|
56
|
+
|
|
57
|
+
```text
|
|
58
|
+
navigation
|
|
59
|
+
headers
|
|
60
|
+
containers
|
|
61
|
+
buttons
|
|
62
|
+
inputs
|
|
63
|
+
lists
|
|
64
|
+
cards
|
|
65
|
+
media
|
|
66
|
+
menus
|
|
67
|
+
sheets
|
|
68
|
+
dialogs
|
|
69
|
+
feedback
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Then determine which are reusable.
|
|
73
|
+
|
|
74
|
+
# 3. COMPONENT HIERARCHY
|
|
75
|
+
|
|
76
|
+
Use four conceptual levels:
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
Primitive
|
|
80
|
+
Component
|
|
81
|
+
Pattern
|
|
82
|
+
Screen
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Example:
|
|
86
|
+
|
|
87
|
+
```text
|
|
88
|
+
Text
|
|
89
|
+
↓
|
|
90
|
+
Button
|
|
91
|
+
↓
|
|
92
|
+
ActionBar
|
|
93
|
+
↓
|
|
94
|
+
SettingsScreen
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
# 4. PRIMITIVES
|
|
98
|
+
|
|
99
|
+
Primitives are foundational UI building blocks.
|
|
100
|
+
|
|
101
|
+
Examples:
|
|
102
|
+
|
|
103
|
+
```text
|
|
104
|
+
Text
|
|
105
|
+
Icon
|
|
106
|
+
Spacer
|
|
107
|
+
Divider
|
|
108
|
+
Stack
|
|
109
|
+
Row
|
|
110
|
+
Column
|
|
111
|
+
Surface
|
|
112
|
+
ScrollView
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
They should be simple and predictable.
|
|
116
|
+
|
|
117
|
+
# 5. COMPONENTS
|
|
118
|
+
|
|
119
|
+
Components represent meaningful interface objects.
|
|
120
|
+
|
|
121
|
+
Examples:
|
|
122
|
+
|
|
123
|
+
```text
|
|
124
|
+
Button
|
|
125
|
+
SearchField
|
|
126
|
+
MediaCard
|
|
127
|
+
ListItem
|
|
128
|
+
TabBar
|
|
129
|
+
NavigationBar
|
|
130
|
+
Toolbar
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
.
|
|
134
|
+
|
|
135
|
+
# 6. PATTERNS
|
|
136
|
+
|
|
137
|
+
Patterns combine components to solve recurring UX problems.
|
|
138
|
+
|
|
139
|
+
Examples:
|
|
140
|
+
|
|
141
|
+
```text
|
|
142
|
+
SearchHeader
|
|
143
|
+
MasterDetail
|
|
144
|
+
SettingsSection
|
|
145
|
+
MediaQueue
|
|
146
|
+
EmptyState
|
|
147
|
+
ConfirmationFlow
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
.
|
|
151
|
+
|
|
152
|
+
# 7. SCREENS
|
|
153
|
+
|
|
154
|
+
Screens compose patterns and components around a specific user task.
|
|
155
|
+
|
|
156
|
+
A screen should generally contain little novel styling.
|
|
157
|
+
|
|
158
|
+
# 8. COMPONENT RESPONSIBILITY
|
|
159
|
+
|
|
160
|
+
Each component should answer:
|
|
161
|
+
|
|
162
|
+
> "What interface responsibility does this component own?"
|
|
163
|
+
|
|
164
|
+
If the answer is:
|
|
165
|
+
|
|
166
|
+
```text
|
|
167
|
+
"everything"
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
the component is too large.
|
|
171
|
+
|
|
172
|
+
# 9. SINGLE RESPONSIBILITY
|
|
173
|
+
|
|
174
|
+
A component should ideally own one coherent concern.
|
|
175
|
+
|
|
176
|
+
Good:
|
|
177
|
+
|
|
178
|
+
```text
|
|
179
|
+
SearchField
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Poor:
|
|
183
|
+
|
|
184
|
+
```text
|
|
185
|
+
SearchFieldWithNavigationAndDataFetchingAndModalAndAnalyticsAndThemeLogic
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
# 10. PRESENTATION VS LOGIC
|
|
189
|
+
|
|
190
|
+
Separate:
|
|
191
|
+
|
|
192
|
+
```text
|
|
193
|
+
UI presentation
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
from:
|
|
197
|
+
|
|
198
|
+
```text
|
|
199
|
+
business logic
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
where practical.
|
|
203
|
+
|
|
204
|
+
Conceptually:
|
|
205
|
+
|
|
206
|
+
```text
|
|
207
|
+
data/state
|
|
208
|
+
↓
|
|
209
|
+
controller/hook
|
|
210
|
+
↓
|
|
211
|
+
component
|
|
212
|
+
↓
|
|
213
|
+
visual presentation
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
# 11. PURE UI COMPONENTS
|
|
217
|
+
|
|
218
|
+
Reusable components should avoid unnecessary knowledge about the application.
|
|
219
|
+
|
|
220
|
+
For example:
|
|
221
|
+
|
|
222
|
+
```tsx
|
|
223
|
+
<Button />
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
should not know:
|
|
227
|
+
|
|
228
|
+
```text
|
|
229
|
+
which database is being used
|
|
230
|
+
which screen is open
|
|
231
|
+
which API is being called
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
.
|
|
235
|
+
|
|
236
|
+
# 12. COMPONENT API
|
|
237
|
+
|
|
238
|
+
A component API should be:
|
|
239
|
+
|
|
240
|
+
```text
|
|
241
|
+
predictable
|
|
242
|
+
small
|
|
243
|
+
semantic
|
|
244
|
+
composable
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
Avoid exposing dozens of styling props.
|
|
248
|
+
|
|
249
|
+
# 13. BAD COMPONENT API
|
|
250
|
+
|
|
251
|
+
Avoid:
|
|
252
|
+
|
|
253
|
+
```tsx
|
|
254
|
+
<Card
|
|
255
|
+
padding={17}
|
|
256
|
+
radius={13}
|
|
257
|
+
color="#..."
|
|
258
|
+
shadow={true}
|
|
259
|
+
marginTop={12}
|
|
260
|
+
...
|
|
261
|
+
/>
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
when these values should come from the design system.
|
|
265
|
+
|
|
266
|
+
# 14. BETTER COMPONENT API
|
|
267
|
+
|
|
268
|
+
Prefer semantic properties:
|
|
269
|
+
|
|
270
|
+
```tsx
|
|
271
|
+
<Card
|
|
272
|
+
variant="elevated"
|
|
273
|
+
size="medium"
|
|
274
|
+
/>
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
The component resolves the correct design tokens.
|
|
278
|
+
|
|
279
|
+
# 15. VARIANTS
|
|
280
|
+
|
|
281
|
+
Variants should represent meaningful states.
|
|
282
|
+
|
|
283
|
+
Examples:
|
|
284
|
+
|
|
285
|
+
```text
|
|
286
|
+
Button:
|
|
287
|
+
primary
|
|
288
|
+
secondary
|
|
289
|
+
tertiary
|
|
290
|
+
destructive
|
|
291
|
+
|
|
292
|
+
Card:
|
|
293
|
+
standard
|
|
294
|
+
interactive
|
|
295
|
+
selected
|
|
296
|
+
|
|
297
|
+
Input:
|
|
298
|
+
standard
|
|
299
|
+
search
|
|
300
|
+
password
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
.
|
|
304
|
+
|
|
305
|
+
# 16. AVOID VARIANT EXPLOSION
|
|
306
|
+
|
|
307
|
+
Do not create:
|
|
308
|
+
|
|
309
|
+
```text
|
|
310
|
+
primarySmallRoundedBlue
|
|
311
|
+
primarySmallRoundedDark
|
|
312
|
+
primaryLargeRoundedBlue
|
|
313
|
+
...
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
This indicates the design system is poorly structured.
|
|
317
|
+
|
|
318
|
+
# 17. STATE VS VARIANT
|
|
319
|
+
|
|
320
|
+
A variant describes intended component role.
|
|
321
|
+
|
|
322
|
+
A state describes current condition.
|
|
323
|
+
|
|
324
|
+
Example:
|
|
325
|
+
|
|
326
|
+
```text
|
|
327
|
+
variant:
|
|
328
|
+
primary
|
|
329
|
+
|
|
330
|
+
state:
|
|
331
|
+
disabled
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
These should not be confused.
|
|
335
|
+
|
|
336
|
+
# 18. COMPONENT STATE MODEL
|
|
337
|
+
|
|
338
|
+
Common states:
|
|
339
|
+
|
|
340
|
+
```text
|
|
341
|
+
idle
|
|
342
|
+
pressed
|
|
343
|
+
focused
|
|
344
|
+
selected
|
|
345
|
+
disabled
|
|
346
|
+
loading
|
|
347
|
+
error
|
|
348
|
+
success
|
|
349
|
+
expanded
|
|
350
|
+
collapsed
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
Only use relevant states.
|
|
354
|
+
|
|
355
|
+
# 19. STATE MACHINE THINKING
|
|
356
|
+
|
|
357
|
+
Interactive components can be modeled as:
|
|
358
|
+
|
|
359
|
+
```text
|
|
360
|
+
idle
|
|
361
|
+
↓
|
|
362
|
+
pressed
|
|
363
|
+
↓
|
|
364
|
+
active
|
|
365
|
+
↓
|
|
366
|
+
success
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
or:
|
|
370
|
+
|
|
371
|
+
```text
|
|
372
|
+
idle
|
|
373
|
+
↓
|
|
374
|
+
loading
|
|
375
|
+
↓
|
|
376
|
+
success
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
The agent should reason about valid transitions.
|
|
380
|
+
|
|
381
|
+
# 20. INVALID STATES
|
|
382
|
+
|
|
383
|
+
The agent should prevent impossible combinations.
|
|
384
|
+
|
|
385
|
+
Example:
|
|
386
|
+
|
|
387
|
+
```text
|
|
388
|
+
disabled + loading
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
may be valid.
|
|
392
|
+
|
|
393
|
+
But:
|
|
394
|
+
|
|
395
|
+
```text
|
|
396
|
+
hidden + focused
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
usually indicates a state-management problem.
|
|
400
|
+
|
|
401
|
+
# 21. COMPONENT CONTRACT
|
|
402
|
+
|
|
403
|
+
Each reusable component should define:
|
|
404
|
+
|
|
405
|
+
```text
|
|
406
|
+
purpose
|
|
407
|
+
inputs
|
|
408
|
+
outputs
|
|
409
|
+
states
|
|
410
|
+
variants
|
|
411
|
+
accessibility
|
|
412
|
+
adaptive behavior
|
|
413
|
+
interaction behavior
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
.
|
|
417
|
+
|
|
418
|
+
# 22. BUTTON ARCHITECTURE
|
|
419
|
+
|
|
420
|
+
A button consists conceptually of:
|
|
421
|
+
|
|
422
|
+
```text
|
|
423
|
+
Button
|
|
424
|
+
├── container
|
|
425
|
+
├── icon
|
|
426
|
+
├── label
|
|
427
|
+
└── state feedback
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
.
|
|
431
|
+
|
|
432
|
+
# 23. BUTTON CONTENT
|
|
433
|
+
|
|
434
|
+
A button may contain:
|
|
435
|
+
|
|
436
|
+
```text
|
|
437
|
+
icon
|
|
438
|
+
text
|
|
439
|
+
icon + text
|
|
440
|
+
loading indicator
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
Do not create separate unrelated components for every combination.
|
|
444
|
+
|
|
445
|
+
# 24. BUTTON HIERARCHY
|
|
446
|
+
|
|
447
|
+
Buttons should communicate:
|
|
448
|
+
|
|
449
|
+
```text
|
|
450
|
+
primary
|
|
451
|
+
secondary
|
|
452
|
+
tertiary
|
|
453
|
+
destructive
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
through the design-token system.
|
|
457
|
+
|
|
458
|
+
# 25. BUTTON INTERACTION
|
|
459
|
+
|
|
460
|
+
A button should provide:
|
|
461
|
+
|
|
462
|
+
```text
|
|
463
|
+
visual feedback
|
|
464
|
+
touch feedback
|
|
465
|
+
disabled behavior
|
|
466
|
+
accessibility label
|
|
467
|
+
loading behavior
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
where applicable.
|
|
471
|
+
|
|
472
|
+
# 26. BUTTON HIT AREA
|
|
473
|
+
|
|
474
|
+
The visual icon does not determine the interaction target.
|
|
475
|
+
|
|
476
|
+
Ensure the actual interactive region remains usable.
|
|
477
|
+
|
|
478
|
+
# 27. ICON BUTTON
|
|
479
|
+
|
|
480
|
+
Icon buttons are appropriate when:
|
|
481
|
+
|
|
482
|
+
```text
|
|
483
|
+
the icon has a familiar meaning
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
or:
|
|
487
|
+
|
|
488
|
+
```text
|
|
489
|
+
the action is obvious from context
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
Otherwise provide a label or tooltip/accessibility description.
|
|
493
|
+
|
|
494
|
+
# 28. ICON BUTTON DANGER
|
|
495
|
+
|
|
496
|
+
Do not use ambiguous icons for destructive operations.
|
|
497
|
+
|
|
498
|
+
Example:
|
|
499
|
+
|
|
500
|
+
```text
|
|
501
|
+
trash
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
is clearer than an arbitrary abstract symbol.
|
|
505
|
+
|
|
506
|
+
# 29. TEXT BUTTON
|
|
507
|
+
|
|
508
|
+
Use text when the action requires explicit explanation.
|
|
509
|
+
|
|
510
|
+
Examples:
|
|
511
|
+
|
|
512
|
+
```text
|
|
513
|
+
Save
|
|
514
|
+
Cancel
|
|
515
|
+
Delete
|
|
516
|
+
Restore
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
.
|
|
520
|
+
|
|
521
|
+
# 30. BUTTON LOADING
|
|
522
|
+
|
|
523
|
+
When loading:
|
|
524
|
+
|
|
525
|
+
```text
|
|
526
|
+
preserve button position
|
|
527
|
+
preserve visual hierarchy
|
|
528
|
+
prevent accidental repeated submission
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
.
|
|
532
|
+
|
|
533
|
+
# 31. INPUT ARCHITECTURE
|
|
534
|
+
|
|
535
|
+
Inputs consist of:
|
|
536
|
+
|
|
537
|
+
```text
|
|
538
|
+
label
|
|
539
|
+
field
|
|
540
|
+
placeholder
|
|
541
|
+
value
|
|
542
|
+
supporting text
|
|
543
|
+
validation
|
|
544
|
+
state
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
Not every input needs every element.
|
|
548
|
+
|
|
549
|
+
# 32. LABELS
|
|
550
|
+
|
|
551
|
+
Important fields should have persistent semantic labels.
|
|
552
|
+
|
|
553
|
+
Do not rely solely on placeholders to communicate what a field means.
|
|
554
|
+
|
|
555
|
+
# 33. PLACEHOLDERS
|
|
556
|
+
|
|
557
|
+
Placeholder text is supplemental guidance.
|
|
558
|
+
|
|
559
|
+
It should not be the only source of field meaning.
|
|
560
|
+
|
|
561
|
+
# 34. INPUT STATES
|
|
562
|
+
|
|
563
|
+
Support appropriate states:
|
|
564
|
+
|
|
565
|
+
```text
|
|
566
|
+
default
|
|
567
|
+
focused
|
|
568
|
+
filled
|
|
569
|
+
disabled
|
|
570
|
+
error
|
|
571
|
+
success
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
.
|
|
575
|
+
|
|
576
|
+
# 35. INPUT VALIDATION
|
|
577
|
+
|
|
578
|
+
Validation should communicate:
|
|
579
|
+
|
|
580
|
+
```text
|
|
581
|
+
what went wrong
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
and:
|
|
585
|
+
|
|
586
|
+
```text
|
|
587
|
+
how to fix it
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
rather than merely:
|
|
591
|
+
|
|
592
|
+
```text
|
|
593
|
+
Invalid input
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
# 36. SEARCH FIELD
|
|
597
|
+
|
|
598
|
+
Search is a specialized input.
|
|
599
|
+
|
|
600
|
+
It may include:
|
|
601
|
+
|
|
602
|
+
```text
|
|
603
|
+
search icon
|
|
604
|
+
clear action
|
|
605
|
+
cancel action
|
|
606
|
+
loading state
|
|
607
|
+
results state
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
depending on context.
|
|
611
|
+
|
|
612
|
+
# 37. SEARCH BEHAVIOR
|
|
613
|
+
|
|
614
|
+
Search interfaces should define:
|
|
615
|
+
|
|
616
|
+
```text
|
|
617
|
+
focus behavior
|
|
618
|
+
keyboard behavior
|
|
619
|
+
query state
|
|
620
|
+
empty query
|
|
621
|
+
loading
|
|
622
|
+
no results
|
|
623
|
+
results
|
|
624
|
+
error
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
.
|
|
628
|
+
|
|
629
|
+
# 38. LIST ARCHITECTURE
|
|
630
|
+
|
|
631
|
+
A list is not merely:
|
|
632
|
+
|
|
633
|
+
```text
|
|
634
|
+
array.map()
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
It is a structured interaction surface.
|
|
638
|
+
|
|
639
|
+
# 39. LIST ITEM
|
|
640
|
+
|
|
641
|
+
A list item may contain:
|
|
642
|
+
|
|
643
|
+
```text
|
|
644
|
+
leading content
|
|
645
|
+
title
|
|
646
|
+
secondary content
|
|
647
|
+
trailing content
|
|
648
|
+
disclosure
|
|
649
|
+
selection state
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
.
|
|
653
|
+
|
|
654
|
+
# 40. LIST HIERARCHY
|
|
655
|
+
|
|
656
|
+
A typical item:
|
|
657
|
+
|
|
658
|
+
```text
|
|
659
|
+
[icon] Title
|
|
660
|
+
Secondary information
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
The title should dominate visually.
|
|
664
|
+
|
|
665
|
+
# 41. LIST DENSITY
|
|
666
|
+
|
|
667
|
+
Density should adapt according to:
|
|
668
|
+
|
|
669
|
+
```text
|
|
670
|
+
content
|
|
671
|
+
available space
|
|
672
|
+
interaction requirements
|
|
673
|
+
accessibility settings
|
|
674
|
+
```
|
|
675
|
+
|
|
676
|
+
.
|
|
677
|
+
|
|
678
|
+
# 42. LIST ACTIONS
|
|
679
|
+
|
|
680
|
+
Actions may be:
|
|
681
|
+
|
|
682
|
+
```text
|
|
683
|
+
tap
|
|
684
|
+
disclosure
|
|
685
|
+
swipe
|
|
686
|
+
context menu
|
|
687
|
+
trailing button
|
|
688
|
+
```
|
|
689
|
+
|
|
690
|
+
Do not expose every possible interaction simultaneously.
|
|
691
|
+
|
|
692
|
+
# 43. SWIPE ACTIONS
|
|
693
|
+
|
|
694
|
+
Use swipe actions for:
|
|
695
|
+
|
|
696
|
+
```text
|
|
697
|
+
frequent contextual operations
|
|
698
|
+
```
|
|
699
|
+
|
|
700
|
+
rather than hiding critical functionality exclusively behind gestures.
|
|
701
|
+
|
|
702
|
+
# 44. CONTEXT MENUS
|
|
703
|
+
|
|
704
|
+
Context menus are useful for secondary actions.
|
|
705
|
+
|
|
706
|
+
Example:
|
|
707
|
+
|
|
708
|
+
```text
|
|
709
|
+
item
|
|
710
|
+
↓ long press / context interaction
|
|
711
|
+
├── Rename
|
|
712
|
+
├── Share
|
|
713
|
+
├── Add to playlist
|
|
714
|
+
└── Delete
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
.
|
|
718
|
+
|
|
719
|
+
# 45. CARD ARCHITECTURE
|
|
720
|
+
|
|
721
|
+
Cards should represent meaningful content groupings.
|
|
722
|
+
|
|
723
|
+
Do not wrap every element inside a card merely because cards look modern.
|
|
724
|
+
|
|
725
|
+
# 46. CARD TYPES
|
|
726
|
+
|
|
727
|
+
Possible semantic variants:
|
|
728
|
+
|
|
729
|
+
```text
|
|
730
|
+
content
|
|
731
|
+
interactive
|
|
732
|
+
media
|
|
733
|
+
summary
|
|
734
|
+
selection
|
|
735
|
+
```
|
|
736
|
+
|
|
737
|
+
.
|
|
738
|
+
|
|
739
|
+
# 47. CARD INTERACTION
|
|
740
|
+
|
|
741
|
+
If the entire card is interactive:
|
|
742
|
+
|
|
743
|
+
```text
|
|
744
|
+
entire surface
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
should behave predictably.
|
|
748
|
+
|
|
749
|
+
Avoid nested conflicting tap targets.
|
|
750
|
+
|
|
751
|
+
# 48. NESTED INTERACTION
|
|
752
|
+
|
|
753
|
+
Avoid:
|
|
754
|
+
|
|
755
|
+
```text
|
|
756
|
+
Card → tap
|
|
757
|
+
└── Button → tap
|
|
758
|
+
```
|
|
759
|
+
|
|
760
|
+
when the resulting interactions are ambiguous.
|
|
761
|
+
|
|
762
|
+
Define clear interaction boundaries.
|
|
763
|
+
|
|
764
|
+
# 49. TOOLBAR ARCHITECTURE
|
|
765
|
+
|
|
766
|
+
Toolbar contains:
|
|
767
|
+
|
|
768
|
+
```text
|
|
769
|
+
navigation
|
|
770
|
+
title
|
|
771
|
+
primary actions
|
|
772
|
+
secondary actions
|
|
773
|
+
```
|
|
774
|
+
|
|
775
|
+
not arbitrary decorative elements.
|
|
776
|
+
|
|
777
|
+
# 50. TOOLBAR ADAPTATION
|
|
778
|
+
|
|
779
|
+
When space decreases:
|
|
780
|
+
|
|
781
|
+
```text
|
|
782
|
+
secondary actions
|
|
783
|
+
↓
|
|
784
|
+
overflow
|
|
785
|
+
```
|
|
786
|
+
|
|
787
|
+
rather than shrinking every icon.
|
|
788
|
+
|
|
789
|
+
# 51. NAVIGATION BAR
|
|
790
|
+
|
|
791
|
+
Navigation components should expose:
|
|
792
|
+
|
|
793
|
+
```text
|
|
794
|
+
destination
|
|
795
|
+
selection
|
|
796
|
+
badge
|
|
797
|
+
accessibility label
|
|
798
|
+
```
|
|
799
|
+
|
|
800
|
+
while presentation adapts to available space.
|
|
801
|
+
|
|
802
|
+
# 52. TAB BAR
|
|
803
|
+
|
|
804
|
+
Tab bars are appropriate for:
|
|
805
|
+
|
|
806
|
+
```text
|
|
807
|
+
top-level destinations
|
|
808
|
+
```
|
|
809
|
+
|
|
810
|
+
not every navigation hierarchy.
|
|
811
|
+
|
|
812
|
+
# 53. TAB COUNT
|
|
813
|
+
|
|
814
|
+
Avoid overcrowding.
|
|
815
|
+
|
|
816
|
+
If destinations cannot be clearly represented:
|
|
817
|
+
|
|
818
|
+
```text
|
|
819
|
+
restructure
|
|
820
|
+
or
|
|
821
|
+
use overflow
|
|
822
|
+
```
|
|
823
|
+
|
|
824
|
+
.
|
|
825
|
+
|
|
826
|
+
# 54. TAB BAR HIERARCHY
|
|
827
|
+
|
|
828
|
+
Each tab should represent a meaningful destination.
|
|
829
|
+
|
|
830
|
+
Do not create tabs for:
|
|
831
|
+
|
|
832
|
+
```text
|
|
833
|
+
temporary actions
|
|
834
|
+
one-off dialogs
|
|
835
|
+
minor settings
|
|
836
|
+
```
|
|
837
|
+
|
|
838
|
+
.
|
|
839
|
+
|
|
840
|
+
# 55. SIDEBAR
|
|
841
|
+
|
|
842
|
+
Sidebars become useful when horizontal space allows persistent navigation.
|
|
843
|
+
|
|
844
|
+
They should not simply duplicate every navigation screen.
|
|
845
|
+
|
|
846
|
+
# 56. SIDEBAR + DETAIL
|
|
847
|
+
|
|
848
|
+
Expanded layout:
|
|
849
|
+
|
|
850
|
+
```text
|
|
851
|
+
Sidebar
|
|
852
|
+
↓
|
|
853
|
+
Collection
|
|
854
|
+
↓
|
|
855
|
+
Detail
|
|
856
|
+
```
|
|
857
|
+
|
|
858
|
+
This is a powerful iPad composition.
|
|
859
|
+
|
|
860
|
+
# 57. HEADER ARCHITECTURE
|
|
861
|
+
|
|
862
|
+
Headers may contain:
|
|
863
|
+
|
|
864
|
+
```text
|
|
865
|
+
navigation
|
|
866
|
+
title
|
|
867
|
+
subtitle
|
|
868
|
+
actions
|
|
869
|
+
search
|
|
870
|
+
filters
|
|
871
|
+
```
|
|
872
|
+
|
|
873
|
+
Only include elements that support the screen's purpose.
|
|
874
|
+
|
|
875
|
+
# 58. LARGE TITLES
|
|
876
|
+
|
|
877
|
+
Large titles can establish strong screen hierarchy.
|
|
878
|
+
|
|
879
|
+
They should transition appropriately when scrolling if the design calls for it.
|
|
880
|
+
|
|
881
|
+
# 59. SCROLL-AWARE HEADERS
|
|
882
|
+
|
|
883
|
+
A header may move between:
|
|
884
|
+
|
|
885
|
+
```text
|
|
886
|
+
expanded
|
|
887
|
+
```
|
|
888
|
+
|
|
889
|
+
and:
|
|
890
|
+
|
|
891
|
+
```text
|
|
892
|
+
compact
|
|
893
|
+
```
|
|
894
|
+
|
|
895
|
+
states based on scroll position.
|
|
896
|
+
|
|
897
|
+
The transition should feel intentional.
|
|
898
|
+
|
|
899
|
+
# 60. SHEET ARCHITECTURE
|
|
900
|
+
|
|
901
|
+
Sheets are appropriate for temporary focused tasks.
|
|
902
|
+
|
|
903
|
+
A sheet may contain:
|
|
904
|
+
|
|
905
|
+
```text
|
|
906
|
+
grabber / header
|
|
907
|
+
title
|
|
908
|
+
content
|
|
909
|
+
actions
|
|
910
|
+
```
|
|
911
|
+
|
|
912
|
+
depending on platform conventions.
|
|
913
|
+
|
|
914
|
+
# 61. SHEET CONTENT
|
|
915
|
+
|
|
916
|
+
A sheet should have a clear task.
|
|
917
|
+
|
|
918
|
+
Avoid turning sheets into miniature applications with excessive navigation.
|
|
919
|
+
|
|
920
|
+
# 62. SHEET HEIGHT
|
|
921
|
+
|
|
922
|
+
Sheet presentation should adapt to content and context.
|
|
923
|
+
|
|
924
|
+
Avoid unnecessary full-screen sheets for tiny tasks.
|
|
925
|
+
|
|
926
|
+
# 63. POPOVER ARCHITECTURE
|
|
927
|
+
|
|
928
|
+
Popovers are useful when users need to:
|
|
929
|
+
|
|
930
|
+
```text
|
|
931
|
+
make a small decision
|
|
932
|
+
```
|
|
933
|
+
|
|
934
|
+
while retaining context.
|
|
935
|
+
|
|
936
|
+
# 64. DIALOG ARCHITECTURE
|
|
937
|
+
|
|
938
|
+
Dialogs should interrupt the user only when necessary.
|
|
939
|
+
|
|
940
|
+
Good use:
|
|
941
|
+
|
|
942
|
+
```text
|
|
943
|
+
destructive confirmation
|
|
944
|
+
critical decision
|
|
945
|
+
permission-related decision
|
|
946
|
+
```
|
|
947
|
+
|
|
948
|
+
Poor use:
|
|
949
|
+
|
|
950
|
+
```text
|
|
951
|
+
minor information
|
|
952
|
+
routine navigation
|
|
953
|
+
simple settings
|
|
954
|
+
```
|
|
955
|
+
|
|
956
|
+
.
|
|
957
|
+
|
|
958
|
+
# 65. ALERTS
|
|
959
|
+
|
|
960
|
+
Alerts should be:
|
|
961
|
+
|
|
962
|
+
```text
|
|
963
|
+
short
|
|
964
|
+
clear
|
|
965
|
+
action-oriented
|
|
966
|
+
```
|
|
967
|
+
|
|
968
|
+
Avoid paragraphs of unnecessary explanation.
|
|
969
|
+
|
|
970
|
+
# 66. CONFIRMATION DIALOGS
|
|
971
|
+
|
|
972
|
+
A destructive confirmation should communicate:
|
|
973
|
+
|
|
974
|
+
```text
|
|
975
|
+
what will happen
|
|
976
|
+
```
|
|
977
|
+
|
|
978
|
+
and:
|
|
979
|
+
|
|
980
|
+
```text
|
|
981
|
+
what action confirms it
|
|
982
|
+
```
|
|
983
|
+
|
|
984
|
+
.
|
|
985
|
+
|
|
986
|
+
# 67. DESTRUCTIVE ACTION ORDER
|
|
987
|
+
|
|
988
|
+
The agent should follow the platform's expected hierarchy and avoid accidental
|
|
989
|
+
destructive taps.
|
|
990
|
+
|
|
991
|
+
# 68. MENUS
|
|
992
|
+
|
|
993
|
+
Menus are useful for:
|
|
994
|
+
|
|
995
|
+
```text
|
|
996
|
+
secondary actions
|
|
997
|
+
sorting
|
|
998
|
+
filtering
|
|
999
|
+
contextual operations
|
|
1000
|
+
```
|
|
1001
|
+
|
|
1002
|
+
.
|
|
1003
|
+
|
|
1004
|
+
# 69. MENU ITEM DESIGN
|
|
1005
|
+
|
|
1006
|
+
Menu items should have:
|
|
1007
|
+
|
|
1008
|
+
```text
|
|
1009
|
+
clear label
|
|
1010
|
+
optional icon
|
|
1011
|
+
selection state where relevant
|
|
1012
|
+
destructive styling where appropriate
|
|
1013
|
+
```
|
|
1014
|
+
|
|
1015
|
+
.
|
|
1016
|
+
|
|
1017
|
+
# 70. SEGMENTED CONTROLS
|
|
1018
|
+
|
|
1019
|
+
Use segmented controls for:
|
|
1020
|
+
|
|
1021
|
+
```text
|
|
1022
|
+
small number of mutually exclusive modes
|
|
1023
|
+
```
|
|
1024
|
+
|
|
1025
|
+
not for long navigation lists.
|
|
1026
|
+
|
|
1027
|
+
# 71. PICKERS
|
|
1028
|
+
|
|
1029
|
+
Pickers are appropriate when users choose from structured options.
|
|
1030
|
+
|
|
1031
|
+
The presentation should match:
|
|
1032
|
+
|
|
1033
|
+
```text
|
|
1034
|
+
number of choices
|
|
1035
|
+
frequency of selection
|
|
1036
|
+
importance of choice
|
|
1037
|
+
available space
|
|
1038
|
+
```
|
|
1039
|
+
|
|
1040
|
+
.
|
|
1041
|
+
|
|
1042
|
+
# 72. CHECKBOX / TOGGLE
|
|
1043
|
+
|
|
1044
|
+
Use a toggle when the setting is:
|
|
1045
|
+
|
|
1046
|
+
```text
|
|
1047
|
+
binary
|
|
1048
|
+
immediate
|
|
1049
|
+
```
|
|
1050
|
+
|
|
1051
|
+
Use other controls when the user must select from multiple alternatives.
|
|
1052
|
+
|
|
1053
|
+
# 73. SWITCH SEMANTICS
|
|
1054
|
+
|
|
1055
|
+
A switch should communicate:
|
|
1056
|
+
|
|
1057
|
+
```text
|
|
1058
|
+
current state
|
|
1059
|
+
```
|
|
1060
|
+
|
|
1061
|
+
and usually apply the change immediately.
|
|
1062
|
+
|
|
1063
|
+
# 74. RADIO-LIKE CHOICES
|
|
1064
|
+
|
|
1065
|
+
Use mutually exclusive selection when exactly one option can be active.
|
|
1066
|
+
|
|
1067
|
+
Do not misuse toggles for mutually exclusive choices.
|
|
1068
|
+
|
|
1069
|
+
# 75. PROGRESS
|
|
1070
|
+
|
|
1071
|
+
Progress indicators should communicate:
|
|
1072
|
+
|
|
1073
|
+
```text
|
|
1074
|
+
known progress
|
|
1075
|
+
```
|
|
1076
|
+
|
|
1077
|
+
when the amount is measurable.
|
|
1078
|
+
|
|
1079
|
+
Use indeterminate loading when it is not.
|
|
1080
|
+
|
|
1081
|
+
# 76. LOADING COMPONENTS
|
|
1082
|
+
|
|
1083
|
+
Loading UI should answer:
|
|
1084
|
+
|
|
1085
|
+
```text
|
|
1086
|
+
What is loading?
|
|
1087
|
+
How long might it take?
|
|
1088
|
+
Can the user continue?
|
|
1089
|
+
```
|
|
1090
|
+
|
|
1091
|
+
when relevant.
|
|
1092
|
+
|
|
1093
|
+
# 77. EMPTY STATE
|
|
1094
|
+
|
|
1095
|
+
An empty state should explain:
|
|
1096
|
+
|
|
1097
|
+
```text
|
|
1098
|
+
what is missing
|
|
1099
|
+
why it is empty
|
|
1100
|
+
what the user can do next
|
|
1101
|
+
```
|
|
1102
|
+
|
|
1103
|
+
.
|
|
1104
|
+
|
|
1105
|
+
# 78. ERROR STATE
|
|
1106
|
+
|
|
1107
|
+
Error UI should explain:
|
|
1108
|
+
|
|
1109
|
+
```text
|
|
1110
|
+
problem
|
|
1111
|
+
impact
|
|
1112
|
+
recovery action
|
|
1113
|
+
```
|
|
1114
|
+
|
|
1115
|
+
where possible.
|
|
1116
|
+
|
|
1117
|
+
# 79. SUCCESS STATE
|
|
1118
|
+
|
|
1119
|
+
Success feedback should confirm completion without unnecessary interruption.
|
|
1120
|
+
|
|
1121
|
+
# 80. BANNERS
|
|
1122
|
+
|
|
1123
|
+
Use banners for persistent contextual information.
|
|
1124
|
+
|
|
1125
|
+
Avoid turning every notification into a modal interruption.
|
|
1126
|
+
|
|
1127
|
+
# 81. TOAST-LIKE FEEDBACK
|
|
1128
|
+
|
|
1129
|
+
Transient feedback should be reserved for:
|
|
1130
|
+
|
|
1131
|
+
```text
|
|
1132
|
+
low-risk confirmation
|
|
1133
|
+
background result
|
|
1134
|
+
minor status update
|
|
1135
|
+
```
|
|
1136
|
+
|
|
1137
|
+
Critical information should not disappear automatically.
|
|
1138
|
+
|
|
1139
|
+
# 82. MEDIA COMPONENT ARCHITECTURE
|
|
1140
|
+
|
|
1141
|
+
For a media application, separate:
|
|
1142
|
+
|
|
1143
|
+
```text
|
|
1144
|
+
MediaState
|
|
1145
|
+
MediaControls
|
|
1146
|
+
MediaProgress
|
|
1147
|
+
MediaArtwork
|
|
1148
|
+
MediaMetadata
|
|
1149
|
+
Queue
|
|
1150
|
+
```
|
|
1151
|
+
|
|
1152
|
+
rather than creating one giant player component.
|
|
1153
|
+
|
|
1154
|
+
# 83. MEDIA CONTROL HIERARCHY
|
|
1155
|
+
|
|
1156
|
+
Typical hierarchy:
|
|
1157
|
+
|
|
1158
|
+
```text
|
|
1159
|
+
primary:
|
|
1160
|
+
play / pause
|
|
1161
|
+
|
|
1162
|
+
secondary:
|
|
1163
|
+
previous / next
|
|
1164
|
+
|
|
1165
|
+
contextual:
|
|
1166
|
+
shuffle / repeat
|
|
1167
|
+
|
|
1168
|
+
advanced:
|
|
1169
|
+
speed / equalizer / output
|
|
1170
|
+
```
|
|
1171
|
+
|
|
1172
|
+
Not every control should have equal visual weight.
|
|
1173
|
+
|
|
1174
|
+
# 84. MINI PLAYER
|
|
1175
|
+
|
|
1176
|
+
A mini player should provide:
|
|
1177
|
+
|
|
1178
|
+
```text
|
|
1179
|
+
current media
|
|
1180
|
+
play/pause
|
|
1181
|
+
navigation to full player
|
|
1182
|
+
```
|
|
1183
|
+
|
|
1184
|
+
without becoming a full player squeezed into a small space.
|
|
1185
|
+
|
|
1186
|
+
# 85. FULL PLAYER
|
|
1187
|
+
|
|
1188
|
+
Full player can expose:
|
|
1189
|
+
|
|
1190
|
+
```text
|
|
1191
|
+
artwork
|
|
1192
|
+
metadata
|
|
1193
|
+
progress
|
|
1194
|
+
primary controls
|
|
1195
|
+
secondary controls
|
|
1196
|
+
queue
|
|
1197
|
+
lyrics
|
|
1198
|
+
additional actions
|
|
1199
|
+
```
|
|
1200
|
+
|
|
1201
|
+
based on product requirements.
|
|
1202
|
+
|
|
1203
|
+
# 86. QUEUE COMPONENT
|
|
1204
|
+
|
|
1205
|
+
Queue architecture should support:
|
|
1206
|
+
|
|
1207
|
+
```text
|
|
1208
|
+
current item
|
|
1209
|
+
upcoming items
|
|
1210
|
+
reordering
|
|
1211
|
+
remove
|
|
1212
|
+
play next
|
|
1213
|
+
clear
|
|
1214
|
+
```
|
|
1215
|
+
|
|
1216
|
+
without mixing playback business logic into the visual component.
|
|
1217
|
+
|
|
1218
|
+
# 87. REUSABLE MEDIA COMPONENTS
|
|
1219
|
+
|
|
1220
|
+
Prefer:
|
|
1221
|
+
|
|
1222
|
+
```text
|
|
1223
|
+
<MediaArtwork />
|
|
1224
|
+
<MediaTitle />
|
|
1225
|
+
<MediaProgress />
|
|
1226
|
+
<PlaybackControls />
|
|
1227
|
+
<QueueList />
|
|
1228
|
+
```
|
|
1229
|
+
|
|
1230
|
+
over:
|
|
1231
|
+
|
|
1232
|
+
```text
|
|
1233
|
+
<EverythingPlayer />
|
|
1234
|
+
```
|
|
1235
|
+
|
|
1236
|
+
# 88. AVATAR COMPONENT
|
|
1237
|
+
|
|
1238
|
+
An avatar may represent:
|
|
1239
|
+
|
|
1240
|
+
```text
|
|
1241
|
+
person
|
|
1242
|
+
artist
|
|
1243
|
+
account
|
|
1244
|
+
group
|
|
1245
|
+
```
|
|
1246
|
+
|
|
1247
|
+
and should support:
|
|
1248
|
+
|
|
1249
|
+
```text
|
|
1250
|
+
image
|
|
1251
|
+
initials
|
|
1252
|
+
fallback
|
|
1253
|
+
status
|
|
1254
|
+
```
|
|
1255
|
+
|
|
1256
|
+
where needed.
|
|
1257
|
+
|
|
1258
|
+
# 89. IMAGE COMPONENT
|
|
1259
|
+
|
|
1260
|
+
An image component should define:
|
|
1261
|
+
|
|
1262
|
+
```text
|
|
1263
|
+
fit
|
|
1264
|
+
fallback
|
|
1265
|
+
loading
|
|
1266
|
+
error
|
|
1267
|
+
aspect ratio
|
|
1268
|
+
accessibility description
|
|
1269
|
+
```
|
|
1270
|
+
|
|
1271
|
+
.
|
|
1272
|
+
|
|
1273
|
+
# 90. SKELETON COMPONENTS
|
|
1274
|
+
|
|
1275
|
+
Skeletons should correspond to actual content components.
|
|
1276
|
+
|
|
1277
|
+
Example:
|
|
1278
|
+
|
|
1279
|
+
```text
|
|
1280
|
+
MediaCardSkeleton
|
|
1281
|
+
ListItemSkeleton
|
|
1282
|
+
ProfileSkeleton
|
|
1283
|
+
```
|
|
1284
|
+
|
|
1285
|
+
rather than one generic rectangle everywhere.
|
|
1286
|
+
|
|
1287
|
+
# 91. DIVIDER
|
|
1288
|
+
|
|
1289
|
+
Dividers should be used when grouping needs explicit visual separation.
|
|
1290
|
+
|
|
1291
|
+
Spacing often communicates grouping better than excessive dividers.
|
|
1292
|
+
|
|
1293
|
+
# 92. SECTION COMPONENT
|
|
1294
|
+
|
|
1295
|
+
A reusable section can provide:
|
|
1296
|
+
|
|
1297
|
+
```text
|
|
1298
|
+
header
|
|
1299
|
+
title
|
|
1300
|
+
subtitle
|
|
1301
|
+
content
|
|
1302
|
+
trailing action
|
|
1303
|
+
```
|
|
1304
|
+
|
|
1305
|
+
This creates consistent page rhythm.
|
|
1306
|
+
|
|
1307
|
+
# 93. SETTINGS COMPONENTS
|
|
1308
|
+
|
|
1309
|
+
Settings often benefit from:
|
|
1310
|
+
|
|
1311
|
+
```text
|
|
1312
|
+
SettingsSection
|
|
1313
|
+
SettingsRow
|
|
1314
|
+
SettingsGroup
|
|
1315
|
+
SettingsDisclosure
|
|
1316
|
+
SettingsToggle
|
|
1317
|
+
```
|
|
1318
|
+
|
|
1319
|
+
rather than manually built rows.
|
|
1320
|
+
|
|
1321
|
+
# 94. SETTINGS ROW
|
|
1322
|
+
|
|
1323
|
+
A row may contain:
|
|
1324
|
+
|
|
1325
|
+
```text
|
|
1326
|
+
leading icon
|
|
1327
|
+
title
|
|
1328
|
+
description
|
|
1329
|
+
value/control
|
|
1330
|
+
disclosure
|
|
1331
|
+
```
|
|
1332
|
+
|
|
1333
|
+
Only include elements that are meaningful.
|
|
1334
|
+
|
|
1335
|
+
# 95. COMPONENT COMPOSITION
|
|
1336
|
+
|
|
1337
|
+
Prefer composition:
|
|
1338
|
+
|
|
1339
|
+
```tsx
|
|
1340
|
+
<SettingsSection>
|
|
1341
|
+
<SettingsRow />
|
|
1342
|
+
<SettingsRow />
|
|
1343
|
+
<SettingsToggle />
|
|
1344
|
+
</SettingsSection>
|
|
1345
|
+
```
|
|
1346
|
+
|
|
1347
|
+
over a giant configuration object when composition improves clarity.
|
|
1348
|
+
|
|
1349
|
+
# 96. SLOT-BASED DESIGN
|
|
1350
|
+
|
|
1351
|
+
Reusable components can expose conceptual slots:
|
|
1352
|
+
|
|
1353
|
+
```text
|
|
1354
|
+
leading
|
|
1355
|
+
content
|
|
1356
|
+
trailing
|
|
1357
|
+
footer
|
|
1358
|
+
```
|
|
1359
|
+
|
|
1360
|
+
This allows composition without duplicating components.
|
|
1361
|
+
|
|
1362
|
+
# 97. COMPOSITION OVER INHERITANCE
|
|
1363
|
+
|
|
1364
|
+
Prefer:
|
|
1365
|
+
|
|
1366
|
+
```text
|
|
1367
|
+
component composition
|
|
1368
|
+
```
|
|
1369
|
+
|
|
1370
|
+
over deeply nested class inheritance.
|
|
1371
|
+
|
|
1372
|
+
This is particularly useful in React-based architectures.
|
|
1373
|
+
|
|
1374
|
+
# 98. COMPONENT EXTENSIBILITY
|
|
1375
|
+
|
|
1376
|
+
A component should allow reasonable customization through:
|
|
1377
|
+
|
|
1378
|
+
```text
|
|
1379
|
+
children
|
|
1380
|
+
slots
|
|
1381
|
+
semantic variants
|
|
1382
|
+
render props
|
|
1383
|
+
```
|
|
1384
|
+
|
|
1385
|
+
where appropriate.
|
|
1386
|
+
|
|
1387
|
+
Do not expose internal implementation details unnecessarily.
|
|
1388
|
+
|
|
1389
|
+
# 99. INTERNAL IMPLEMENTATION
|
|
1390
|
+
|
|
1391
|
+
Consumers should not need to know:
|
|
1392
|
+
|
|
1393
|
+
```text
|
|
1394
|
+
which View
|
|
1395
|
+
which Animated component
|
|
1396
|
+
which native primitive
|
|
1397
|
+
```
|
|
1398
|
+
|
|
1399
|
+
was used internally.
|
|
1400
|
+
|
|
1401
|
+
# 100. COMPONENT BOUNDARIES
|
|
1402
|
+
|
|
1403
|
+
A component boundary should correspond to:
|
|
1404
|
+
|
|
1405
|
+
```text
|
|
1406
|
+
reusability
|
|
1407
|
+
responsibility
|
|
1408
|
+
state ownership
|
|
1409
|
+
visual identity
|
|
1410
|
+
```
|
|
1411
|
+
|
|
1412
|
+
.
|
|
1413
|
+
|
|
1414
|
+
# 101. STATE OWNERSHIP
|
|
1415
|
+
|
|
1416
|
+
State should live as close as practical to the component or feature that owns
|
|
1417
|
+
it.
|
|
1418
|
+
|
|
1419
|
+
Do not place every tiny UI state in a global store.
|
|
1420
|
+
|
|
1421
|
+
# 102. GLOBAL STATE
|
|
1422
|
+
|
|
1423
|
+
Global state is appropriate for things such as:
|
|
1424
|
+
|
|
1425
|
+
```text
|
|
1426
|
+
authentication
|
|
1427
|
+
theme
|
|
1428
|
+
playback
|
|
1429
|
+
user preferences
|
|
1430
|
+
application-wide navigation
|
|
1431
|
+
```
|
|
1432
|
+
|
|
1433
|
+
depending on architecture.
|
|
1434
|
+
|
|
1435
|
+
# 103. LOCAL STATE
|
|
1436
|
+
|
|
1437
|
+
Local state is appropriate for:
|
|
1438
|
+
|
|
1439
|
+
```text
|
|
1440
|
+
pressed
|
|
1441
|
+
expanded
|
|
1442
|
+
focused
|
|
1443
|
+
temporary input
|
|
1444
|
+
dropdown open
|
|
1445
|
+
```
|
|
1446
|
+
|
|
1447
|
+
when it does not need global access.
|
|
1448
|
+
|
|
1449
|
+
# 104. CONTROLLED COMPONENTS
|
|
1450
|
+
|
|
1451
|
+
Components that need external state should support controlled usage when useful.
|
|
1452
|
+
|
|
1453
|
+
Example:
|
|
1454
|
+
|
|
1455
|
+
```tsx
|
|
1456
|
+
<Disclosure
|
|
1457
|
+
expanded={expanded}
|
|
1458
|
+
onExpandedChange={setExpanded}
|
|
1459
|
+
/>
|
|
1460
|
+
```
|
|
1461
|
+
|
|
1462
|
+
# 105. UNCONTROLLED COMPONENTS
|
|
1463
|
+
|
|
1464
|
+
Simple components may manage their own temporary state.
|
|
1465
|
+
|
|
1466
|
+
The architecture should support the appropriate model rather than forcing one
|
|
1467
|
+
pattern everywhere.
|
|
1468
|
+
|
|
1469
|
+
# 106. EVENT API
|
|
1470
|
+
|
|
1471
|
+
Use semantic callbacks.
|
|
1472
|
+
|
|
1473
|
+
Good:
|
|
1474
|
+
|
|
1475
|
+
```text
|
|
1476
|
+
onPress
|
|
1477
|
+
onSubmit
|
|
1478
|
+
onValueChange
|
|
1479
|
+
onExpandedChange
|
|
1480
|
+
onSelectionChange
|
|
1481
|
+
```
|
|
1482
|
+
|
|
1483
|
+
Avoid callbacks named after implementation details.
|
|
1484
|
+
|
|
1485
|
+
# 107. EVENT SEMANTICS
|
|
1486
|
+
|
|
1487
|
+
Callbacks should communicate user intent.
|
|
1488
|
+
|
|
1489
|
+
Example:
|
|
1490
|
+
|
|
1491
|
+
```text
|
|
1492
|
+
onDelete
|
|
1493
|
+
```
|
|
1494
|
+
|
|
1495
|
+
is more meaningful than:
|
|
1496
|
+
|
|
1497
|
+
```text
|
|
1498
|
+
onButton2Click
|
|
1499
|
+
```
|
|
1500
|
+
|
|
1501
|
+
# 108. COMPONENT ACCESSIBILITY
|
|
1502
|
+
|
|
1503
|
+
Every interactive component should define:
|
|
1504
|
+
|
|
1505
|
+
```text
|
|
1506
|
+
role
|
|
1507
|
+
label
|
|
1508
|
+
state
|
|
1509
|
+
value
|
|
1510
|
+
hint
|
|
1511
|
+
action
|
|
1512
|
+
```
|
|
1513
|
+
|
|
1514
|
+
as appropriate.
|
|
1515
|
+
|
|
1516
|
+
# 109. ACCESSIBILITY MUST BE BUILT-IN
|
|
1517
|
+
|
|
1518
|
+
Do not bolt accessibility onto components after implementation.
|
|
1519
|
+
|
|
1520
|
+
The component architecture should make accessible behavior the default.
|
|
1521
|
+
|
|
1522
|
+
# 110. ACCESSIBILITY LABELS
|
|
1523
|
+
|
|
1524
|
+
Visible text should normally provide semantic meaning automatically.
|
|
1525
|
+
|
|
1526
|
+
Icon-only controls require explicit accessible naming.
|
|
1527
|
+
|
|
1528
|
+
# 111. ACCESSIBILITY STATES
|
|
1529
|
+
|
|
1530
|
+
Expose states such as:
|
|
1531
|
+
|
|
1532
|
+
```text
|
|
1533
|
+
selected
|
|
1534
|
+
disabled
|
|
1535
|
+
expanded
|
|
1536
|
+
checked
|
|
1537
|
+
busy
|
|
1538
|
+
```
|
|
1539
|
+
|
|
1540
|
+
through the appropriate platform accessibility mechanisms.
|
|
1541
|
+
|
|
1542
|
+
# 112. ACCESSIBILITY ACTIONS
|
|
1543
|
+
|
|
1544
|
+
Complex custom controls may need explicit accessible actions.
|
|
1545
|
+
|
|
1546
|
+
Do not assume visual gestures automatically become accessible interactions.
|
|
1547
|
+
|
|
1548
|
+
# 113. ADAPTIVE COMPONENTS
|
|
1549
|
+
|
|
1550
|
+
Components should be capable of changing composition.
|
|
1551
|
+
|
|
1552
|
+
Example:
|
|
1553
|
+
|
|
1554
|
+
```text
|
|
1555
|
+
Toolbar
|
|
1556
|
+
↓
|
|
1557
|
+
compact
|
|
1558
|
+
↓
|
|
1559
|
+
actions collapse
|
|
1560
|
+
|
|
1561
|
+
Toolbar
|
|
1562
|
+
↓
|
|
1563
|
+
expanded
|
|
1564
|
+
↓
|
|
1565
|
+
actions visible
|
|
1566
|
+
```
|
|
1567
|
+
|
|
1568
|
+
.
|
|
1569
|
+
|
|
1570
|
+
# 114. COMPONENT CONTAINER AWARENESS
|
|
1571
|
+
|
|
1572
|
+
When practical, components should respond to their available space rather than
|
|
1573
|
+
the identity of the device.
|
|
1574
|
+
|
|
1575
|
+
# 115. RESPONSIVE VARIANTS
|
|
1576
|
+
|
|
1577
|
+
Use:
|
|
1578
|
+
|
|
1579
|
+
```text
|
|
1580
|
+
compact
|
|
1581
|
+
regular
|
|
1582
|
+
expanded
|
|
1583
|
+
```
|
|
1584
|
+
|
|
1585
|
+
only when the composition genuinely changes.
|
|
1586
|
+
|
|
1587
|
+
# 116. COMPONENT STABILITY
|
|
1588
|
+
|
|
1589
|
+
A component should remain recognizable across adaptive states.
|
|
1590
|
+
|
|
1591
|
+
Example:
|
|
1592
|
+
|
|
1593
|
+
```text
|
|
1594
|
+
same button
|
|
1595
|
+
different width
|
|
1596
|
+
```
|
|
1597
|
+
|
|
1598
|
+
is preferable to:
|
|
1599
|
+
|
|
1600
|
+
```text
|
|
1601
|
+
completely different control
|
|
1602
|
+
```
|
|
1603
|
+
|
|
1604
|
+
unless the interaction model truly changes.
|
|
1605
|
+
|
|
1606
|
+
# 117. COMPONENT IDENTITY
|
|
1607
|
+
|
|
1608
|
+
Adapt:
|
|
1609
|
+
|
|
1610
|
+
```text
|
|
1611
|
+
layout
|
|
1612
|
+
density
|
|
1613
|
+
presentation
|
|
1614
|
+
```
|
|
1615
|
+
|
|
1616
|
+
while preserving:
|
|
1617
|
+
|
|
1618
|
+
```text
|
|
1619
|
+
meaning
|
|
1620
|
+
```
|
|
1621
|
+
|
|
1622
|
+
.
|
|
1623
|
+
|
|
1624
|
+
# 118. COMPONENT TRANSITIONS
|
|
1625
|
+
|
|
1626
|
+
When changing state:
|
|
1627
|
+
|
|
1628
|
+
```text
|
|
1629
|
+
default → pressed
|
|
1630
|
+
collapsed → expanded
|
|
1631
|
+
loading → complete
|
|
1632
|
+
```
|
|
1633
|
+
|
|
1634
|
+
transitions should preserve visual continuity where useful.
|
|
1635
|
+
|
|
1636
|
+
# 119. COMPONENT MOTION
|
|
1637
|
+
|
|
1638
|
+
Motion belongs to the component's behavior contract.
|
|
1639
|
+
|
|
1640
|
+
It should not be separately reinvented on every screen.
|
|
1641
|
+
|
|
1642
|
+
# 120. PERFORMANCE
|
|
1643
|
+
|
|
1644
|
+
Reusable components should avoid unnecessary:
|
|
1645
|
+
|
|
1646
|
+
```text
|
|
1647
|
+
re-renders
|
|
1648
|
+
layout calculations
|
|
1649
|
+
animations
|
|
1650
|
+
state subscriptions
|
|
1651
|
+
```
|
|
1652
|
+
|
|
1653
|
+
especially in large lists.
|
|
1654
|
+
|
|
1655
|
+
# 121. LIST PERFORMANCE
|
|
1656
|
+
|
|
1657
|
+
For large datasets:
|
|
1658
|
+
|
|
1659
|
+
```text
|
|
1660
|
+
virtualization
|
|
1661
|
+
stable keys
|
|
1662
|
+
memoization where appropriate
|
|
1663
|
+
minimal row state
|
|
1664
|
+
```
|
|
1665
|
+
|
|
1666
|
+
should be considered.
|
|
1667
|
+
|
|
1668
|
+
# 122. COMPONENT REUSE VS OVER-ABSTRACTION
|
|
1669
|
+
|
|
1670
|
+
Reuse when:
|
|
1671
|
+
|
|
1672
|
+
```text
|
|
1673
|
+
structure + semantics + behavior
|
|
1674
|
+
```
|
|
1675
|
+
|
|
1676
|
+
are genuinely shared.
|
|
1677
|
+
|
|
1678
|
+
Do not abstract two visually similar components if their semantics differ
|
|
1679
|
+
significantly.
|
|
1680
|
+
|
|
1681
|
+
# 123. DUPLICATION TEST
|
|
1682
|
+
|
|
1683
|
+
Before creating a component:
|
|
1684
|
+
|
|
1685
|
+
```text
|
|
1686
|
+
Does this pattern already exist?
|
|
1687
|
+
```
|
|
1688
|
+
|
|
1689
|
+
If yes:
|
|
1690
|
+
|
|
1691
|
+
```text
|
|
1692
|
+
reuse
|
|
1693
|
+
```
|
|
1694
|
+
|
|
1695
|
+
or:
|
|
1696
|
+
|
|
1697
|
+
```text
|
|
1698
|
+
extend the existing component
|
|
1699
|
+
```
|
|
1700
|
+
|
|
1701
|
+
rather than creating a duplicate.
|
|
1702
|
+
|
|
1703
|
+
# 124. COMPONENT DISCOVERY
|
|
1704
|
+
|
|
1705
|
+
A mature repository should make components easy to find.
|
|
1706
|
+
|
|
1707
|
+
Conceptually:
|
|
1708
|
+
|
|
1709
|
+
```text
|
|
1710
|
+
components/
|
|
1711
|
+
├── primitives/
|
|
1712
|
+
├── controls/
|
|
1713
|
+
├── navigation/
|
|
1714
|
+
├── feedback/
|
|
1715
|
+
├── media/
|
|
1716
|
+
├── forms/
|
|
1717
|
+
└── layout/
|
|
1718
|
+
```
|
|
1719
|
+
|
|
1720
|
+
# 125. COMPONENT NAMING
|
|
1721
|
+
|
|
1722
|
+
Names should describe semantic purpose.
|
|
1723
|
+
|
|
1724
|
+
Good:
|
|
1725
|
+
|
|
1726
|
+
```text
|
|
1727
|
+
MediaCard
|
|
1728
|
+
SearchField
|
|
1729
|
+
SettingsRow
|
|
1730
|
+
PlaybackControls
|
|
1731
|
+
```
|
|
1732
|
+
|
|
1733
|
+
Poor:
|
|
1734
|
+
|
|
1735
|
+
```text
|
|
1736
|
+
BlueBox
|
|
1737
|
+
FancyCard
|
|
1738
|
+
CustomThing
|
|
1739
|
+
NewComponent2
|
|
1740
|
+
```
|
|
1741
|
+
|
|
1742
|
+
# 126. COMPONENT FILE STRUCTURE
|
|
1743
|
+
|
|
1744
|
+
A component may conceptually contain:
|
|
1745
|
+
|
|
1746
|
+
```text
|
|
1747
|
+
Component/
|
|
1748
|
+
├── Component.tsx
|
|
1749
|
+
├── Component.styles.ts
|
|
1750
|
+
├── Component.types.ts
|
|
1751
|
+
├── Component.test.tsx
|
|
1752
|
+
└── index.ts
|
|
1753
|
+
```
|
|
1754
|
+
|
|
1755
|
+
The exact project structure may differ.
|
|
1756
|
+
|
|
1757
|
+
# 127. COMPONENT DOCUMENTATION
|
|
1758
|
+
|
|
1759
|
+
Important reusable components should document:
|
|
1760
|
+
|
|
1761
|
+
```text
|
|
1762
|
+
purpose
|
|
1763
|
+
variants
|
|
1764
|
+
states
|
|
1765
|
+
props
|
|
1766
|
+
usage
|
|
1767
|
+
accessibility
|
|
1768
|
+
adaptive behavior
|
|
1769
|
+
```
|
|
1770
|
+
|
|
1771
|
+
.
|
|
1772
|
+
|
|
1773
|
+
# 128. COMPONENT PREVIEW
|
|
1774
|
+
|
|
1775
|
+
A component system benefits from isolated previews.
|
|
1776
|
+
|
|
1777
|
+
The agent should be able to inspect:
|
|
1778
|
+
|
|
1779
|
+
```text
|
|
1780
|
+
default
|
|
1781
|
+
pressed
|
|
1782
|
+
disabled
|
|
1783
|
+
loading
|
|
1784
|
+
error
|
|
1785
|
+
dark mode
|
|
1786
|
+
large text
|
|
1787
|
+
compact width
|
|
1788
|
+
expanded width
|
|
1789
|
+
```
|
|
1790
|
+
|
|
1791
|
+
.
|
|
1792
|
+
|
|
1793
|
+
# 129. COMPONENT TEST MATRIX
|
|
1794
|
+
|
|
1795
|
+
For important components:
|
|
1796
|
+
|
|
1797
|
+
```text
|
|
1798
|
+
visual
|
|
1799
|
+
interaction
|
|
1800
|
+
accessibility
|
|
1801
|
+
responsive
|
|
1802
|
+
state
|
|
1803
|
+
performance
|
|
1804
|
+
```
|
|
1805
|
+
|
|
1806
|
+
should be considered.
|
|
1807
|
+
|
|
1808
|
+
# 130. COMPONENT VISUAL REGRESSION
|
|
1809
|
+
|
|
1810
|
+
A design-system change should be checked for unintended changes to existing
|
|
1811
|
+
components.
|
|
1812
|
+
|
|
1813
|
+
# 131. COMPONENT CONTRACT TEST
|
|
1814
|
+
|
|
1815
|
+
Every component should answer:
|
|
1816
|
+
|
|
1817
|
+
```text
|
|
1818
|
+
What does it do?
|
|
1819
|
+
What states can it enter?
|
|
1820
|
+
What inputs does it accept?
|
|
1821
|
+
What outputs does it produce?
|
|
1822
|
+
How does it adapt?
|
|
1823
|
+
How is it accessed?
|
|
1824
|
+
```
|
|
1825
|
+
|
|
1826
|
+
If these answers are unclear, the component needs refinement.
|
|
1827
|
+
|
|
1828
|
+
# 132. AGENT COMPONENT GENERATION WORKFLOW
|
|
1829
|
+
|
|
1830
|
+
```text
|
|
1831
|
+
USER REQUEST
|
|
1832
|
+
↓
|
|
1833
|
+
IDENTIFY TASK
|
|
1834
|
+
↓
|
|
1835
|
+
IDENTIFY UI OBJECTS
|
|
1836
|
+
↓
|
|
1837
|
+
CHECK EXISTING COMPONENTS
|
|
1838
|
+
↓
|
|
1839
|
+
REUSE WHEN POSSIBLE
|
|
1840
|
+
↓
|
|
1841
|
+
SELECT VARIANTS
|
|
1842
|
+
↓
|
|
1843
|
+
SELECT DESIGN TOKENS
|
|
1844
|
+
↓
|
|
1845
|
+
DEFINE STATES
|
|
1846
|
+
↓
|
|
1847
|
+
DEFINE ACCESSIBILITY
|
|
1848
|
+
↓
|
|
1849
|
+
DEFINE ADAPTIVE BEHAVIOR
|
|
1850
|
+
↓
|
|
1851
|
+
IMPLEMENT
|
|
1852
|
+
↓
|
|
1853
|
+
TEST STATES
|
|
1854
|
+
↓
|
|
1855
|
+
TEST COMPACT / EXPANDED
|
|
1856
|
+
↓
|
|
1857
|
+
TEST ACCESSIBILITY
|
|
1858
|
+
```
|
|
1859
|
+
|
|
1860
|
+
# 133. AGENT REUSE RULE
|
|
1861
|
+
|
|
1862
|
+
Before generating a new component, the agent should search the existing project.
|
|
1863
|
+
|
|
1864
|
+
Priority:
|
|
1865
|
+
|
|
1866
|
+
```text
|
|
1867
|
+
existing component
|
|
1868
|
+
↓
|
|
1869
|
+
existing pattern
|
|
1870
|
+
↓
|
|
1871
|
+
existing primitive
|
|
1872
|
+
↓
|
|
1873
|
+
extend existing system
|
|
1874
|
+
↓
|
|
1875
|
+
create new component
|
|
1876
|
+
```
|
|
1877
|
+
|
|
1878
|
+
Creating a new component should not be the first choice.
|
|
1879
|
+
|
|
1880
|
+
# 134. AGENT COMPONENT AUDIT
|
|
1881
|
+
|
|
1882
|
+
When reviewing a screen, identify:
|
|
1883
|
+
|
|
1884
|
+
```text
|
|
1885
|
+
duplicate buttons
|
|
1886
|
+
duplicate cards
|
|
1887
|
+
duplicate rows
|
|
1888
|
+
duplicate headers
|
|
1889
|
+
duplicate modals
|
|
1890
|
+
duplicate inputs
|
|
1891
|
+
duplicate spacing systems
|
|
1892
|
+
```
|
|
1893
|
+
|
|
1894
|
+
Then consolidate where appropriate.
|
|
1895
|
+
|
|
1896
|
+
# 135. AGENT ANTI-PATTERN
|
|
1897
|
+
|
|
1898
|
+
Reject components containing:
|
|
1899
|
+
|
|
1900
|
+
```text
|
|
1901
|
+
hundreds of unrelated props
|
|
1902
|
+
device-specific branches everywhere
|
|
1903
|
+
hard-coded design values
|
|
1904
|
+
business logic mixed with visual primitives
|
|
1905
|
+
duplicate state systems
|
|
1906
|
+
inaccessible custom controls
|
|
1907
|
+
```
|
|
1908
|
+
|
|
1909
|
+
.
|
|
1910
|
+
|
|
1911
|
+
# 136. COMPONENT ARCHITECTURE PRINCIPLE
|
|
1912
|
+
|
|
1913
|
+
The best component is not the component with the most flexibility.
|
|
1914
|
+
|
|
1915
|
+
It is the component with:
|
|
1916
|
+
|
|
1917
|
+
```text
|
|
1918
|
+
clear semantics
|
|
1919
|
+
small API
|
|
1920
|
+
predictable behavior
|
|
1921
|
+
appropriate flexibility
|
|
1922
|
+
strong defaults
|
|
1923
|
+
```
|
|
1924
|
+
|
|
1925
|
+
.
|
|
1926
|
+
|
|
1927
|
+
# 137. DEFAULTS
|
|
1928
|
+
|
|
1929
|
+
Components should have good defaults.
|
|
1930
|
+
|
|
1931
|
+
Example:
|
|
1932
|
+
|
|
1933
|
+
```text
|
|
1934
|
+
<Button />
|
|
1935
|
+
```
|
|
1936
|
+
|
|
1937
|
+
should already look correct.
|
|
1938
|
+
|
|
1939
|
+
Consumers should not need to configure:
|
|
1940
|
+
|
|
1941
|
+
```text
|
|
1942
|
+
padding
|
|
1943
|
+
radius
|
|
1944
|
+
font
|
|
1945
|
+
color
|
|
1946
|
+
shadow
|
|
1947
|
+
```
|
|
1948
|
+
|
|
1949
|
+
for ordinary usage.
|
|
1950
|
+
|
|
1951
|
+
# 138. CUSTOMIZATION
|
|
1952
|
+
|
|
1953
|
+
Customization should happen through semantic options:
|
|
1954
|
+
|
|
1955
|
+
```text
|
|
1956
|
+
variant
|
|
1957
|
+
size
|
|
1958
|
+
state
|
|
1959
|
+
leading
|
|
1960
|
+
trailing
|
|
1961
|
+
```
|
|
1962
|
+
|
|
1963
|
+
rather than raw styling whenever possible.
|
|
1964
|
+
|
|
1965
|
+
# 139. DESIGN SYSTEM ENFORCEMENT
|
|
1966
|
+
|
|
1967
|
+
The agent should prefer design-system components over raw primitives when a
|
|
1968
|
+
semantic component already exists.
|
|
1969
|
+
|
|
1970
|
+
Example:
|
|
1971
|
+
|
|
1972
|
+
```text
|
|
1973
|
+
Use:
|
|
1974
|
+
<Button />
|
|
1975
|
+
|
|
1976
|
+
instead of:
|
|
1977
|
+
<View><Pressable>...</Pressable></View>
|
|
1978
|
+
```
|
|
1979
|
+
|
|
1980
|
+
when the interaction is a standard button.
|
|
1981
|
+
|
|
1982
|
+
# 140. RAW PRIMITIVES
|
|
1983
|
+
|
|
1984
|
+
Raw primitives remain appropriate when:
|
|
1985
|
+
|
|
1986
|
+
```text
|
|
1987
|
+
no existing semantic component fits
|
|
1988
|
+
```
|
|
1989
|
+
|
|
1990
|
+
or:
|
|
1991
|
+
|
|
1992
|
+
```text
|
|
1993
|
+
the interface requires a genuinely unique composition
|
|
1994
|
+
```
|
|
1995
|
+
|
|
1996
|
+
The agent should then consider whether the new pattern is reusable.
|
|
1997
|
+
|
|
1998
|
+
# 141. COMPONENT MATURITY
|
|
1999
|
+
|
|
2000
|
+
Components can evolve through:
|
|
2001
|
+
|
|
2002
|
+
```text
|
|
2003
|
+
prototype
|
|
2004
|
+
↓
|
|
2005
|
+
reusable
|
|
2006
|
+
↓
|
|
2007
|
+
system component
|
|
2008
|
+
↓
|
|
2009
|
+
stable component
|
|
2010
|
+
```
|
|
2011
|
+
|
|
2012
|
+
Do not prematurely build massive abstractions.
|
|
2013
|
+
|
|
2014
|
+
# 142. COMPONENT DEPRECATION
|
|
2015
|
+
|
|
2016
|
+
If a component becomes obsolete:
|
|
2017
|
+
|
|
2018
|
+
```text
|
|
2019
|
+
identify replacements
|
|
2020
|
+
migrate usage
|
|
2021
|
+
remove duplication
|
|
2022
|
+
document migration
|
|
2023
|
+
```
|
|
2024
|
+
|
|
2025
|
+
Avoid leaving dead components indefinitely.
|
|
2026
|
+
|
|
2027
|
+
# 143. COMPONENT VERSIONING
|
|
2028
|
+
|
|
2029
|
+
Major behavioral changes should be treated carefully because many screens may
|
|
2030
|
+
depend on the component.
|
|
2031
|
+
|
|
2032
|
+
# 144. PLATFORM ADAPTATION
|
|
2033
|
+
|
|
2034
|
+
A shared component architecture should allow platform-specific behavior.
|
|
2035
|
+
|
|
2036
|
+
Example:
|
|
2037
|
+
|
|
2038
|
+
```text
|
|
2039
|
+
shared Button API
|
|
2040
|
+
↓
|
|
2041
|
+
iOS implementation
|
|
2042
|
+
↓
|
|
2043
|
+
Android implementation
|
|
2044
|
+
```
|
|
2045
|
+
|
|
2046
|
+
when platform conventions differ.
|
|
2047
|
+
|
|
2048
|
+
# 145. APPLE-NATIVE PRIORITY
|
|
2049
|
+
|
|
2050
|
+
When implementing an iOS component:
|
|
2051
|
+
|
|
2052
|
+
```text
|
|
2053
|
+
platform behavior
|
|
2054
|
+
+
|
|
2055
|
+
platform accessibility
|
|
2056
|
+
+
|
|
2057
|
+
platform interaction
|
|
2058
|
+
+
|
|
2059
|
+
design-system consistency
|
|
2060
|
+
```
|
|
2061
|
+
|
|
2062
|
+
should guide the implementation.
|
|
2063
|
+
|
|
2064
|
+
# 146. DO NOT COPY WEB COMPONENTS
|
|
2065
|
+
|
|
2066
|
+
Web patterns should not automatically be transferred to mobile.
|
|
2067
|
+
|
|
2068
|
+
Examples requiring careful adaptation:
|
|
2069
|
+
|
|
2070
|
+
```text
|
|
2071
|
+
hover menus
|
|
2072
|
+
desktop toolbars
|
|
2073
|
+
tiny icon controls
|
|
2074
|
+
dense tables
|
|
2075
|
+
mouse-first interactions
|
|
2076
|
+
```
|
|
2077
|
+
|
|
2078
|
+
.
|
|
2079
|
+
|
|
2080
|
+
# 147. TOUCH-FIRST COMPONENTS
|
|
2081
|
+
|
|
2082
|
+
Interactive components should assume:
|
|
2083
|
+
|
|
2084
|
+
```text
|
|
2085
|
+
touch
|
|
2086
|
+
gesture
|
|
2087
|
+
visual feedback
|
|
2088
|
+
limited precision
|
|
2089
|
+
```
|
|
2090
|
+
|
|
2091
|
+
while supporting pointer/keyboard interaction where appropriate.
|
|
2092
|
+
|
|
2093
|
+
# 148. GESTURE COMPONENTS
|
|
2094
|
+
|
|
2095
|
+
Gestures should have:
|
|
2096
|
+
|
|
2097
|
+
```text
|
|
2098
|
+
discoverability
|
|
2099
|
+
fallback interaction
|
|
2100
|
+
accessibility alternative
|
|
2101
|
+
clear state
|
|
2102
|
+
```
|
|
2103
|
+
|
|
2104
|
+
when the action is important.
|
|
2105
|
+
|
|
2106
|
+
# 149. GESTURE + COMPONENT
|
|
2107
|
+
|
|
2108
|
+
Do not hide critical actions exclusively behind gestures.
|
|
2109
|
+
|
|
2110
|
+
Example:
|
|
2111
|
+
|
|
2112
|
+
```text
|
|
2113
|
+
swipe to delete
|
|
2114
|
+
```
|
|
2115
|
+
|
|
2116
|
+
should generally have another discoverable route such as a context action.
|
|
2117
|
+
|
|
2118
|
+
# 150. COMPONENT COMPOSITION MASTER MODEL
|
|
2119
|
+
|
|
2120
|
+
```text
|
|
2121
|
+
DESIGN TOKENS
|
|
2122
|
+
│
|
|
2123
|
+
↓
|
|
2124
|
+
PRIMITIVES
|
|
2125
|
+
│
|
|
2126
|
+
┌──────────────┼──────────────┐
|
|
2127
|
+
↓ ↓ ↓
|
|
2128
|
+
Controls Containers Content
|
|
2129
|
+
│ │ │
|
|
2130
|
+
└──────────────┼──────────────┘
|
|
2131
|
+
↓
|
|
2132
|
+
COMPONENTS
|
|
2133
|
+
│
|
|
2134
|
+
↓
|
|
2135
|
+
PATTERNS
|
|
2136
|
+
│
|
|
2137
|
+
↓
|
|
2138
|
+
SCREENS
|
|
2139
|
+
│
|
|
2140
|
+
↓
|
|
2141
|
+
FLOWS
|
|
2142
|
+
```
|
|
2143
|
+
|
|
2144
|
+
# 151. FINAL COMPONENT DIRECTIVE
|
|
2145
|
+
|
|
2146
|
+
The agent must never think:
|
|
2147
|
+
|
|
2148
|
+
> "I need to build a screen."
|
|
2149
|
+
|
|
2150
|
+
It should think:
|
|
2151
|
+
|
|
2152
|
+
> "I need to compose a user task from reusable, semantic, accessible,
|
|
2153
|
+
> adaptive components."
|
|
2154
|
+
|
|
2155
|
+
Then:
|
|
2156
|
+
|
|
2157
|
+
```text
|
|
2158
|
+
existing system
|
|
2159
|
+
↓
|
|
2160
|
+
reuse
|
|
2161
|
+
↓
|
|
2162
|
+
compose
|
|
2163
|
+
↓
|
|
2164
|
+
adapt
|
|
2165
|
+
↓
|
|
2166
|
+
extend only when necessary
|
|
2167
|
+
```
|
|
2168
|
+
|
|
2169
|
+
# 152. QUALITY BAR
|
|
2170
|
+
|
|
2171
|
+
A mature component architecture should produce interfaces that feel:
|
|
2172
|
+
|
|
2173
|
+
```text
|
|
2174
|
+
coherent
|
|
2175
|
+
predictable
|
|
2176
|
+
native
|
|
2177
|
+
consistent
|
|
2178
|
+
adaptive
|
|
2179
|
+
accessible
|
|
2180
|
+
maintainable
|
|
2181
|
+
```
|
|
2182
|
+
|
|
2183
|
+
while still allowing individual screens to have personality.
|
|
2184
|
+
|
|
2185
|
+
# 153. MASTER AGENT RULE
|
|
2186
|
+
|
|
2187
|
+
Before writing UI code:
|
|
2188
|
+
|
|
2189
|
+
```text
|
|
2190
|
+
1. Search existing components.
|
|
2191
|
+
2. Search existing patterns.
|
|
2192
|
+
3. Identify semantic role.
|
|
2193
|
+
4. Select design tokens.
|
|
2194
|
+
5. Define component states.
|
|
2195
|
+
6. Define accessibility behavior.
|
|
2196
|
+
7. Define adaptive behavior.
|
|
2197
|
+
8. Define interaction behavior.
|
|
2198
|
+
9. Compose the screen.
|
|
2199
|
+
10. Audit for duplication.
|
|
2200
|
+
```
|
|
2201
|
+
|
|
2202
|
+
The component system is the application's visual grammar.
|
|
2203
|
+
|
|
2204
|
+
Screens are sentences written using that grammar.
|
|
2205
|
+
|
|
2206
|
+
````
|
|
2207
|
+
|
|
2208
|
+
|