@elsahafy/ux-mcp-server 2.0.0 → 4.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/README.md +159 -18
- package/dist/index.js +2130 -8
- package/knowledge/ai-ml-patterns.json +192 -0
- package/knowledge/analytics-metrics.json +521 -0
- package/knowledge/angular-patterns.json +347 -0
- package/knowledge/ar-vr-interfaces.json +139 -0
- package/knowledge/color-theory.json +499 -0
- package/knowledge/data-viz.json +527 -0
- package/knowledge/design-system-advanced.json +533 -0
- package/knowledge/ecommerce-patterns.json +616 -0
- package/knowledge/ethical-design.json +484 -0
- package/knowledge/finance-ux.json +208 -0
- package/knowledge/forms.json +641 -0
- package/knowledge/haptic-feedback.json +102 -0
- package/knowledge/healthcare-ux.json +209 -0
- package/knowledge/information-architecture.json +494 -0
- package/knowledge/microcopy.json +743 -0
- package/knowledge/mobile-patterns.json +537 -0
- package/knowledge/neurodiversity.json +228 -0
- package/knowledge/pwa-patterns.json +429 -0
- package/knowledge/saas-patterns.json +613 -0
- package/knowledge/testing-validation.json +561 -0
- package/knowledge/typography.json +509 -0
- package/knowledge/voice-ui.json +359 -0
- package/knowledge/vue-patterns.json +279 -0
- package/knowledge/web-components.json +148 -0
- package/package.json +1 -1
|
@@ -0,0 +1,641 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Form Design Patterns",
|
|
3
|
+
"description": "Comprehensive guide to designing accessible, user-friendly forms with validation patterns and best practices",
|
|
4
|
+
"layout_patterns": {
|
|
5
|
+
"single_column": {
|
|
6
|
+
"description": "One field per row - most accessible and mobile-friendly",
|
|
7
|
+
"use_when": "Most forms, especially mobile-first designs",
|
|
8
|
+
"benefits": [
|
|
9
|
+
"Easier to scan vertically",
|
|
10
|
+
"Better for mobile devices",
|
|
11
|
+
"Clearer completion flow",
|
|
12
|
+
"Improved accessibility",
|
|
13
|
+
"Higher completion rates"
|
|
14
|
+
],
|
|
15
|
+
"example": "<form>\n <label for='email'>Email</label>\n <input type='email' id='email'>\n \n <label for='password'>Password</label>\n <input type='password' id='password'>\n \n <button>Sign In</button>\n</form>",
|
|
16
|
+
"avoid": "Multi-column layouts unless fields are naturally grouped (city, state, zip)"
|
|
17
|
+
},
|
|
18
|
+
"multi_column": {
|
|
19
|
+
"description": "Multiple fields per row",
|
|
20
|
+
"use_when": "Related fields (city/state/zip), desktop with ample space",
|
|
21
|
+
"guidelines": [
|
|
22
|
+
"Group related fields logically",
|
|
23
|
+
"Use for short fields (city, state, zip code)",
|
|
24
|
+
"Ensure fields align visually",
|
|
25
|
+
"Collapse to single column on mobile"
|
|
26
|
+
],
|
|
27
|
+
"example": "<div class='form-row'>\n <div class='col'>\n <label for='city'>City</label>\n <input id='city'>\n </div>\n <div class='col'>\n <label for='state'>State</label>\n <select id='state'>...</select>\n </div>\n <div class='col'>\n <label for='zip'>ZIP</label>\n <input id='zip'>\n </div>\n</div>",
|
|
28
|
+
"max_columns": 3,
|
|
29
|
+
"accessibility_concern": "Can be harder for screen readers, ensure logical tab order"
|
|
30
|
+
},
|
|
31
|
+
"multi_step_wizard": {
|
|
32
|
+
"description": "Break long forms into multiple steps",
|
|
33
|
+
"use_when": "Forms with 10+ fields or complex logic",
|
|
34
|
+
"benefits": [
|
|
35
|
+
"Reduces cognitive load",
|
|
36
|
+
"Shows progress",
|
|
37
|
+
"Allows saving partial progress",
|
|
38
|
+
"Better mobile experience",
|
|
39
|
+
"Higher completion rates for long forms"
|
|
40
|
+
],
|
|
41
|
+
"essential_components": {
|
|
42
|
+
"progress_indicator": {
|
|
43
|
+
"types": ["Step counter (1 of 4)", "Progress bar", "Breadcrumb trail"],
|
|
44
|
+
"best_practice": "Show step labels and current position",
|
|
45
|
+
"example": "<div class='wizard-progress'>\n <div class='step completed'>Personal Info</div>\n <div class='step active'>Address</div>\n <div class='step'>Payment</div>\n <div class='step'>Review</div>\n</div>"
|
|
46
|
+
},
|
|
47
|
+
"navigation": {
|
|
48
|
+
"required": ["Next/Continue button", "Back button (except step 1)"],
|
|
49
|
+
"optional": ["Save for later", "Skip (if applicable)"],
|
|
50
|
+
"validation": "Validate current step before proceeding",
|
|
51
|
+
"keyboard": "Support Enter to advance, Escape to cancel"
|
|
52
|
+
},
|
|
53
|
+
"data_persistence": {
|
|
54
|
+
"save_progress": "Save on each step completion",
|
|
55
|
+
"recovery": "Allow users to return to incomplete forms",
|
|
56
|
+
"session_timeout": "Warn before timing out"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"step_design": [
|
|
60
|
+
"Each step should be logical and complete",
|
|
61
|
+
"Group related fields in same step",
|
|
62
|
+
"Keep steps balanced in length",
|
|
63
|
+
"Show validation errors within step",
|
|
64
|
+
"Allow editing previous steps"
|
|
65
|
+
],
|
|
66
|
+
"anti_patterns": [
|
|
67
|
+
"Too many steps (> 7)",
|
|
68
|
+
"Unbalanced step lengths",
|
|
69
|
+
"No progress indication",
|
|
70
|
+
"Can't go back to edit",
|
|
71
|
+
"Lose data if session expires"
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
"inline_editing": {
|
|
75
|
+
"description": "Edit fields directly in place",
|
|
76
|
+
"use_when": "Settings pages, profile editing, admin panels",
|
|
77
|
+
"pattern": "Click to edit, save/cancel buttons appear",
|
|
78
|
+
"example": "<div class='editable-field'>\n <span class='value'>john@example.com</span>\n <button class='edit-btn'>Edit</button>\n <!-- On click: -->\n <input value='john@example.com'>\n <button class='save-btn'>Save</button>\n <button class='cancel-btn'>Cancel</button>\n</div>",
|
|
79
|
+
"keyboard": "Enter to save, Escape to cancel",
|
|
80
|
+
"accessibility": "Announce state changes to screen readers"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"field_types": {
|
|
84
|
+
"text_input": {
|
|
85
|
+
"basic": {
|
|
86
|
+
"html": "<label for='name'>Full Name</label>\n<input type='text' id='name' autocomplete='name'>",
|
|
87
|
+
"attributes": {
|
|
88
|
+
"type": "text, email, tel, url, search",
|
|
89
|
+
"autocomplete": "Use HTML autocomplete attributes",
|
|
90
|
+
"inputmode": "text, numeric, tel, email, url for mobile keyboards",
|
|
91
|
+
"placeholder": "Optional - don't replace labels",
|
|
92
|
+
"maxlength": "Limit input length if needed"
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"best_practices": [
|
|
96
|
+
"Always use <label> elements",
|
|
97
|
+
"Enable autocomplete where appropriate",
|
|
98
|
+
"Use correct input type for mobile keyboards",
|
|
99
|
+
"Don't use placeholder as label",
|
|
100
|
+
"Set appropriate width (visual cue for expected length)",
|
|
101
|
+
"Disable autocorrect for usernames/codes"
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
"textarea": {
|
|
105
|
+
"use": "Multi-line text input",
|
|
106
|
+
"example": "<label for='message'>Message</label>\n<textarea id='message' rows='4'></textarea>",
|
|
107
|
+
"features": {
|
|
108
|
+
"auto_resize": "Grow height as user types",
|
|
109
|
+
"character_count": "Show remaining characters if limited",
|
|
110
|
+
"rich_text": "Consider rich text editor for formatting"
|
|
111
|
+
},
|
|
112
|
+
"accessibility": "Set rows attribute for default height"
|
|
113
|
+
},
|
|
114
|
+
"select_dropdown": {
|
|
115
|
+
"use": "Choose one from many options (> 5 options)",
|
|
116
|
+
"example": "<label for='country'>Country</label>\n<select id='country'>\n <option value=''>Select a country</option>\n <option value='us'>United States</option>\n <option value='ca'>Canada</option>\n</select>",
|
|
117
|
+
"best_practices": [
|
|
118
|
+
"Include default 'Select...' option",
|
|
119
|
+
"Sort alphabetically for long lists",
|
|
120
|
+
"Group related options with <optgroup>",
|
|
121
|
+
"Consider autocomplete for very long lists (countries)",
|
|
122
|
+
"Use single-select for mutually exclusive choices"
|
|
123
|
+
],
|
|
124
|
+
"alternatives": {
|
|
125
|
+
"radio_buttons": "For 2-5 options (better visibility)",
|
|
126
|
+
"autocomplete": "For very long lists (100+ options)",
|
|
127
|
+
"button_group": "For 2-3 options with icons"
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
"radio_buttons": {
|
|
131
|
+
"use": "Choose one from few options (2-5)",
|
|
132
|
+
"example": "<fieldset>\n <legend>Shipping Method</legend>\n <label>\n <input type='radio' name='shipping' value='standard'>\n Standard (5-7 days)\n </label>\n <label>\n <input type='radio' name='shipping' value='express'>\n Express (2-3 days)\n </label>\n</fieldset>",
|
|
133
|
+
"best_practices": [
|
|
134
|
+
"Use <fieldset> and <legend>",
|
|
135
|
+
"Show all options (don't hide in dropdown)",
|
|
136
|
+
"One option should be pre-selected if there's a default",
|
|
137
|
+
"Use same 'name' attribute for grouping",
|
|
138
|
+
"Clicking label should select radio"
|
|
139
|
+
],
|
|
140
|
+
"layout": "Vertical stack preferred for accessibility"
|
|
141
|
+
},
|
|
142
|
+
"checkboxes": {
|
|
143
|
+
"use": "Multiple selections, on/off toggles",
|
|
144
|
+
"single": {
|
|
145
|
+
"example": "<label>\n <input type='checkbox' name='terms'>\n I agree to the terms and conditions\n</label>",
|
|
146
|
+
"use": "Agreement, opt-in/out"
|
|
147
|
+
},
|
|
148
|
+
"multiple": {
|
|
149
|
+
"example": "<fieldset>\n <legend>Interests</legend>\n <label><input type='checkbox' name='interests' value='tech'>Technology</label>\n <label><input type='checkbox' name='interests' value='design'>Design</label>\n <label><input type='checkbox' name='interests' value='business'>Business</label>\n</fieldset>",
|
|
150
|
+
"use": "Select multiple from list"
|
|
151
|
+
},
|
|
152
|
+
"best_practices": [
|
|
153
|
+
"Use for independent options (not mutually exclusive)",
|
|
154
|
+
"Show 'Select All' for long lists",
|
|
155
|
+
"Use <fieldset> for groups",
|
|
156
|
+
"Make entire label clickable"
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
"toggle_switch": {
|
|
160
|
+
"use": "On/off settings that take effect immediately",
|
|
161
|
+
"implementation": "Checkbox styled as toggle",
|
|
162
|
+
"example": "<label class='toggle'>\n <input type='checkbox' role='switch'>\n <span class='slider'></span>\n Enable notifications\n</label>",
|
|
163
|
+
"when_to_use": "Settings that take effect immediately (not form submission)",
|
|
164
|
+
"accessibility": "role='switch', aria-checked state"
|
|
165
|
+
},
|
|
166
|
+
"date_picker": {
|
|
167
|
+
"types": {
|
|
168
|
+
"native": {
|
|
169
|
+
"html": "<input type='date' id='dob'>",
|
|
170
|
+
"pros": ["Built-in", "Mobile-friendly", "Accessible"],
|
|
171
|
+
"cons": ["Limited styling", "Browser inconsistency"]
|
|
172
|
+
},
|
|
173
|
+
"custom": {
|
|
174
|
+
"libraries": ["Flatpickr", "react-datepicker", "Air Datepicker"],
|
|
175
|
+
"must_haves": ["Keyboard navigation", "Today button", "Clear button", "Format display"]
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
"best_practices": [
|
|
179
|
+
"Show date format hint (MM/DD/YYYY)",
|
|
180
|
+
"Allow manual text entry",
|
|
181
|
+
"Disable past dates if not applicable",
|
|
182
|
+
"Use appropriate locale format",
|
|
183
|
+
"Provide calendar icon button"
|
|
184
|
+
],
|
|
185
|
+
"date_range": {
|
|
186
|
+
"pattern": "Two date pickers (start/end)",
|
|
187
|
+
"validation": "End date must be after start date",
|
|
188
|
+
"ux": "Clicking end date should show start date as minimum"
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
"file_upload": {
|
|
192
|
+
"basic": {
|
|
193
|
+
"html": "<label for='file'>Upload Resume</label>\n<input type='file' id='file' accept='.pdf,.doc,.docx'>",
|
|
194
|
+
"attributes": {
|
|
195
|
+
"accept": "Limit file types (.pdf, image/*)",
|
|
196
|
+
"multiple": "Allow multiple files"
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
"enhanced": {
|
|
200
|
+
"features": [
|
|
201
|
+
"Drag and drop zone",
|
|
202
|
+
"File preview (images)",
|
|
203
|
+
"Upload progress bar",
|
|
204
|
+
"File size validation",
|
|
205
|
+
"Remove uploaded file option"
|
|
206
|
+
],
|
|
207
|
+
"example": "<div class='upload-zone'>\n <input type='file' id='upload' hidden>\n <label for='upload' class='drop-zone'>\n <span>Drag files here or click to browse</span>\n <span class='hint'>PDF, DOC up to 10MB</span>\n </label>\n</div>"
|
|
208
|
+
},
|
|
209
|
+
"validation": [
|
|
210
|
+
"Check file size before upload",
|
|
211
|
+
"Validate file type",
|
|
212
|
+
"Show clear error messages",
|
|
213
|
+
"Scan for viruses on server"
|
|
214
|
+
],
|
|
215
|
+
"ux": [
|
|
216
|
+
"Show file name after selection",
|
|
217
|
+
"Show upload progress",
|
|
218
|
+
"Allow removing files before submit",
|
|
219
|
+
"Support drag and drop"
|
|
220
|
+
]
|
|
221
|
+
},
|
|
222
|
+
"search_autocomplete": {
|
|
223
|
+
"use": "Search with suggestions, select from large list",
|
|
224
|
+
"pattern": "Combo box (text input + dropdown)",
|
|
225
|
+
"example": "<label for='city'>City</label>\n<input type='text' id='city' role='combobox' aria-autocomplete='list' aria-controls='city-list'>\n<ul id='city-list' role='listbox' hidden>\n <!-- Suggestions populate here -->\n</ul>",
|
|
226
|
+
"behavior": [
|
|
227
|
+
"Show suggestions after 2-3 characters",
|
|
228
|
+
"Debounce requests (300ms)",
|
|
229
|
+
"Highlight matching text",
|
|
230
|
+
"Keyboard navigation (up/down arrows)",
|
|
231
|
+
"Escape to close",
|
|
232
|
+
"Enter to select"
|
|
233
|
+
],
|
|
234
|
+
"accessibility": [
|
|
235
|
+
"role='combobox' on input",
|
|
236
|
+
"aria-autocomplete='list'",
|
|
237
|
+
"Announce number of results",
|
|
238
|
+
"aria-activedescendant for highlighted item"
|
|
239
|
+
]
|
|
240
|
+
},
|
|
241
|
+
"password": {
|
|
242
|
+
"basic": {
|
|
243
|
+
"html": "<label for='password'>Password</label>\n<input type='password' id='password' autocomplete='new-password'>",
|
|
244
|
+
"show_hide_toggle": "<button type='button' aria-label='Show password'>👁️</button>"
|
|
245
|
+
},
|
|
246
|
+
"strength_indicator": {
|
|
247
|
+
"display": "Visual bar showing weak/medium/strong",
|
|
248
|
+
"criteria": "Length, uppercase, numbers, symbols",
|
|
249
|
+
"real_time": "Update as user types",
|
|
250
|
+
"example": "<div class='password-strength'>\n <div class='strength-bar weak'></div>\n <span>Weak - Add numbers and symbols</span>\n</div>"
|
|
251
|
+
},
|
|
252
|
+
"best_practices": [
|
|
253
|
+
"Allow paste (don't disable)",
|
|
254
|
+
"Show password toggle",
|
|
255
|
+
"Real-time strength feedback",
|
|
256
|
+
"Don't require complex rules without reason",
|
|
257
|
+
"Use autocomplete='new-password' for registration",
|
|
258
|
+
"Use autocomplete='current-password' for login"
|
|
259
|
+
],
|
|
260
|
+
"requirements_display": {
|
|
261
|
+
"show_upfront": "Display requirements before user types",
|
|
262
|
+
"check_as_typed": "Show ✓ for met requirements",
|
|
263
|
+
"example": "<ul class='password-requirements'>\n <li class='met'>✓ At least 8 characters</li>\n <li class='unmet'>One uppercase letter</li>\n <li class='unmet'>One number</li>\n</ul>"
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
"number_input": {
|
|
267
|
+
"types": {
|
|
268
|
+
"stepper": {
|
|
269
|
+
"html": "<input type='number' min='1' max='10' step='1'>",
|
|
270
|
+
"use": "Quantities, small range",
|
|
271
|
+
"ux": "Provide +/- buttons"
|
|
272
|
+
},
|
|
273
|
+
"slider": {
|
|
274
|
+
"html": "<input type='range' min='0' max='100' value='50'>",
|
|
275
|
+
"use": "Range selection, volume, zoom",
|
|
276
|
+
"accessibility": "Show current value"
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
"best_practices": [
|
|
280
|
+
"Use inputmode='numeric' for mobile",
|
|
281
|
+
"Set min/max/step appropriately",
|
|
282
|
+
"Show units (%, $, kg)",
|
|
283
|
+
"Allow keyboard input",
|
|
284
|
+
"Consider slider for ranges"
|
|
285
|
+
]
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
"validation": {
|
|
289
|
+
"timing": {
|
|
290
|
+
"on_submit": {
|
|
291
|
+
"description": "Validate when form is submitted",
|
|
292
|
+
"use": "Default approach, least intrusive",
|
|
293
|
+
"scroll_to_error": "Scroll to first error and focus"
|
|
294
|
+
},
|
|
295
|
+
"on_blur": {
|
|
296
|
+
"description": "Validate when field loses focus",
|
|
297
|
+
"use": "After user completes field",
|
|
298
|
+
"avoid": "Don't show errors while user is still typing",
|
|
299
|
+
"example": "input.addEventListener('blur', validateField);"
|
|
300
|
+
},
|
|
301
|
+
"real_time": {
|
|
302
|
+
"description": "Validate as user types",
|
|
303
|
+
"use": "Password strength, username availability, character count",
|
|
304
|
+
"debounce": "Wait 300-500ms after typing stops",
|
|
305
|
+
"avoid": "Showing errors immediately (wait for blur or submission)"
|
|
306
|
+
},
|
|
307
|
+
"hybrid_approach": {
|
|
308
|
+
"recommended": "Inline validation on blur + submit validation",
|
|
309
|
+
"pattern": "Show errors on blur, revalidate on change after error shown",
|
|
310
|
+
"ux": "Best of both - timely feedback without annoyance"
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
"error_messages": {
|
|
314
|
+
"placement": {
|
|
315
|
+
"inline": "Below the field (preferred)",
|
|
316
|
+
"summary": "Top of form listing all errors",
|
|
317
|
+
"both": "Inline + summary for long forms"
|
|
318
|
+
},
|
|
319
|
+
"content": {
|
|
320
|
+
"specific": "Explain exactly what's wrong",
|
|
321
|
+
"good": "Password must be at least 8 characters",
|
|
322
|
+
"bad": "Invalid password",
|
|
323
|
+
"actionable": "Tell user how to fix it",
|
|
324
|
+
"polite": "Avoid blame (You entered... → This field...)"
|
|
325
|
+
},
|
|
326
|
+
"styling": {
|
|
327
|
+
"color": "Red with icon (don't rely on color alone)",
|
|
328
|
+
"icon": "⚠️ or ❌ for errors",
|
|
329
|
+
"aria": "aria-invalid='true' + aria-describedby"
|
|
330
|
+
},
|
|
331
|
+
"example": "<label for='email'>Email</label>\n<input type='email' id='email' aria-invalid='true' aria-describedby='email-error'>\n<span id='email-error' class='error' role='alert'>\n Please enter a valid email address (e.g., name@example.com)\n</span>"
|
|
332
|
+
},
|
|
333
|
+
"validation_rules": {
|
|
334
|
+
"required_fields": {
|
|
335
|
+
"indicator": "Asterisk (*) or '(required)' label",
|
|
336
|
+
"error": "'Email is required'",
|
|
337
|
+
"html": "<input required aria-required='true'>"
|
|
338
|
+
},
|
|
339
|
+
"format_validation": {
|
|
340
|
+
"email": "Use type='email' + pattern if needed",
|
|
341
|
+
"phone": "Be flexible with formats",
|
|
342
|
+
"zip_code": "Country-specific patterns",
|
|
343
|
+
"example": "<input type='tel' pattern='[0-9]{3}-[0-9]{3}-[0-9]{4}' placeholder='555-123-4567'>"
|
|
344
|
+
},
|
|
345
|
+
"length_validation": {
|
|
346
|
+
"minlength": "Minimum characters",
|
|
347
|
+
"maxlength": "Maximum characters",
|
|
348
|
+
"show_count": "Display character count for long fields"
|
|
349
|
+
},
|
|
350
|
+
"custom_validation": {
|
|
351
|
+
"password_match": "Confirm password must match",
|
|
352
|
+
"unique_username": "Check availability (debounced)",
|
|
353
|
+
"age_verification": "Calculate from date of birth"
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
"success_feedback": {
|
|
357
|
+
"show": "Optional but helpful",
|
|
358
|
+
"inline": "Green checkmark ✓ next to validated fields",
|
|
359
|
+
"example": "<span class='success'>✓ Available</span>",
|
|
360
|
+
"use_cases": ["Username availability", "Valid coupon code", "Email format correct"]
|
|
361
|
+
},
|
|
362
|
+
"progressive_disclosure": {
|
|
363
|
+
"description": "Show validation hints progressively",
|
|
364
|
+
"pattern": "Show requirements → Validate → Show success/error",
|
|
365
|
+
"example": "Password field shows requirements on focus, validates on blur"
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
"labels_and_help": {
|
|
369
|
+
"labels": {
|
|
370
|
+
"always_required": "Every input must have a label",
|
|
371
|
+
"visible": "Visible labels are better than aria-label",
|
|
372
|
+
"placement": "Above field (preferred) or to the left",
|
|
373
|
+
"example": "<label for='email'>Email Address</label>\n<input type='email' id='email'>",
|
|
374
|
+
"for_attribute": "Must match input id",
|
|
375
|
+
"clickable": "Clicking label should focus input"
|
|
376
|
+
},
|
|
377
|
+
"placeholders": {
|
|
378
|
+
"purpose": "Example or format hint",
|
|
379
|
+
"not_a_label": "Never replace label with placeholder",
|
|
380
|
+
"disappears": "Placeholder disappears when typing",
|
|
381
|
+
"example": "<label for='phone'>Phone Number</label>\n<input id='phone' placeholder='555-123-4567'>",
|
|
382
|
+
"accessibility": "Low contrast, not read by all screen readers",
|
|
383
|
+
"when_to_use": "Supplement labels, show format examples"
|
|
384
|
+
},
|
|
385
|
+
"help_text": {
|
|
386
|
+
"purpose": "Additional guidance or context",
|
|
387
|
+
"placement": "Below label or field",
|
|
388
|
+
"example": "<label for='username'>Username</label>\n<span id='username-help' class='help-text'>3-20 characters, letters and numbers only</span>\n<input id='username' aria-describedby='username-help'>",
|
|
389
|
+
"accessibility": "Use aria-describedby to associate with input",
|
|
390
|
+
"when_to_use": ["Complex requirements", "Format specifications", "Security info", "Character limits"]
|
|
391
|
+
},
|
|
392
|
+
"tooltips": {
|
|
393
|
+
"use": "Additional information, not critical instructions",
|
|
394
|
+
"trigger": "? icon or info icon",
|
|
395
|
+
"example": "<label>SSN <button type='button' class='tooltip-trigger'>?</button></label>",
|
|
396
|
+
"accessibility": "Must be keyboard accessible",
|
|
397
|
+
"avoid": "Don't hide critical info in tooltips"
|
|
398
|
+
},
|
|
399
|
+
"required_indicators": {
|
|
400
|
+
"methods": {
|
|
401
|
+
"asterisk": "Most common (*)",
|
|
402
|
+
"text": "(required) or (optional)",
|
|
403
|
+
"both": "* (required)"
|
|
404
|
+
},
|
|
405
|
+
"legend": "Explain meaning at top of form: '* indicates required field'",
|
|
406
|
+
"optional_approach": "Mark optional fields if most are required",
|
|
407
|
+
"accessibility": "aria-required='true' or required attribute"
|
|
408
|
+
}
|
|
409
|
+
},
|
|
410
|
+
"submission": {
|
|
411
|
+
"button_states": {
|
|
412
|
+
"default": "<button type='submit'>Submit</button>",
|
|
413
|
+
"loading": {
|
|
414
|
+
"disabled": "Disable button during submission",
|
|
415
|
+
"visual": "Show spinner or loading text",
|
|
416
|
+
"example": "<button type='submit' disabled>\n <span class='spinner'></span> Submitting...\n</button>",
|
|
417
|
+
"prevent_double_submit": "Disable on first click"
|
|
418
|
+
},
|
|
419
|
+
"success": {
|
|
420
|
+
"feedback": "Show success message",
|
|
421
|
+
"redirect": "Redirect after confirmation message",
|
|
422
|
+
"example": "Form submitted! Redirecting..."
|
|
423
|
+
},
|
|
424
|
+
"error": {
|
|
425
|
+
"show_errors": "Display validation errors",
|
|
426
|
+
"re_enable": "Re-enable submit button",
|
|
427
|
+
"scroll_to_error": "Scroll to first error"
|
|
428
|
+
}
|
|
429
|
+
},
|
|
430
|
+
"button_text": {
|
|
431
|
+
"specific": "Describe the action",
|
|
432
|
+
"good": ["Create Account", "Save Changes", "Continue to Payment"],
|
|
433
|
+
"bad": ["Submit", "OK", "Send"],
|
|
434
|
+
"loading_state": ["Saving...", "Processing...", "Creating Account..."]
|
|
435
|
+
},
|
|
436
|
+
"success_messages": {
|
|
437
|
+
"placement": "Top of form or full-page confirmation",
|
|
438
|
+
"content": "Confirm action and next steps",
|
|
439
|
+
"example": "✓ Your account has been created! Check your email to verify.",
|
|
440
|
+
"auto_dismiss": "Optional for non-critical messages",
|
|
441
|
+
"accessibility": "Announce with role='status' or role='alert'"
|
|
442
|
+
},
|
|
443
|
+
"error_summary": {
|
|
444
|
+
"show_at_top": "List all errors at form top",
|
|
445
|
+
"focus_on_submit": "Focus error summary on failed submission",
|
|
446
|
+
"example": "<div class='error-summary' role='alert'>\n <h2>Please fix the following errors:</h2>\n <ul>\n <li><a href='#email'>Email is required</a></li>\n <li><a href='#password'>Password is too short</a></li>\n </ul>\n</div>",
|
|
447
|
+
"links": "Link to each error field"
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
"accessibility": {
|
|
451
|
+
"keyboard_navigation": {
|
|
452
|
+
"tab_order": "Logical tab order through fields",
|
|
453
|
+
"required_keys": {
|
|
454
|
+
"tab": "Move to next field",
|
|
455
|
+
"shift_tab": "Move to previous field",
|
|
456
|
+
"enter": "Submit form",
|
|
457
|
+
"space": "Toggle checkbox/radio"
|
|
458
|
+
},
|
|
459
|
+
"skip_link": "Provide skip to content link",
|
|
460
|
+
"focus_visible": "Clear focus indicator on all fields"
|
|
461
|
+
},
|
|
462
|
+
"screen_reader": {
|
|
463
|
+
"labels": "All inputs must have labels",
|
|
464
|
+
"aria_attributes": {
|
|
465
|
+
"aria_required": "Mark required fields",
|
|
466
|
+
"aria_invalid": "Mark fields with errors",
|
|
467
|
+
"aria_describedby": "Associate help text and errors",
|
|
468
|
+
"aria_labelledby": "For complex label associations"
|
|
469
|
+
},
|
|
470
|
+
"error_announcement": "Use role='alert' for dynamic errors",
|
|
471
|
+
"fieldset_legend": "Use for radio/checkbox groups"
|
|
472
|
+
},
|
|
473
|
+
"wcag_compliance": {
|
|
474
|
+
"labels": "1.3.1 Info and Relationships (Level A)",
|
|
475
|
+
"error_identification": "3.3.1 Error Identification (Level A)",
|
|
476
|
+
"error_suggestion": "3.3.3 Error Suggestion (Level AA)",
|
|
477
|
+
"error_prevention": "3.3.4 Error Prevention (Level AA)",
|
|
478
|
+
"contrast": "Text and error messages must meet 4.5:1 contrast"
|
|
479
|
+
}
|
|
480
|
+
},
|
|
481
|
+
"mobile_optimization": {
|
|
482
|
+
"input_types": {
|
|
483
|
+
"email": "Shows @ on keyboard",
|
|
484
|
+
"tel": "Shows number pad",
|
|
485
|
+
"url": "Shows .com on keyboard",
|
|
486
|
+
"number": "Shows number pad",
|
|
487
|
+
"date": "Shows date picker"
|
|
488
|
+
},
|
|
489
|
+
"inputmode": {
|
|
490
|
+
"numeric": "Number pad without +/-",
|
|
491
|
+
"decimal": "Number pad with decimal",
|
|
492
|
+
"tel": "Phone pad",
|
|
493
|
+
"example": "<input type='text' inputmode='numeric'>"
|
|
494
|
+
},
|
|
495
|
+
"touch_targets": {
|
|
496
|
+
"minimum_size": "44x44px (iOS), 48x48px (Android)",
|
|
497
|
+
"spacing": "8px minimum between touch targets",
|
|
498
|
+
"applies_to": "Inputs, buttons, checkboxes, radio buttons"
|
|
499
|
+
},
|
|
500
|
+
"autofill": {
|
|
501
|
+
"autocomplete": "Use HTML autocomplete attributes",
|
|
502
|
+
"values": {
|
|
503
|
+
"name": "Full name",
|
|
504
|
+
"email": "Email address",
|
|
505
|
+
"tel": "Phone number",
|
|
506
|
+
"address_line1": "Street address",
|
|
507
|
+
"postal_code": "ZIP/postal code",
|
|
508
|
+
"cc_number": "Credit card number"
|
|
509
|
+
},
|
|
510
|
+
"example": "<input type='email' autocomplete='email'>"
|
|
511
|
+
},
|
|
512
|
+
"virtual_keyboard": {
|
|
513
|
+
"avoid_covering": "Scroll field into view when focused",
|
|
514
|
+
"fixed_submit": "Keep submit button accessible",
|
|
515
|
+
"resize_handling": "Handle viewport resize when keyboard appears"
|
|
516
|
+
}
|
|
517
|
+
},
|
|
518
|
+
"best_practices": [
|
|
519
|
+
"Use single-column layout for most forms",
|
|
520
|
+
"Always use visible labels (not just placeholders)",
|
|
521
|
+
"Mark required fields clearly with * or (required)",
|
|
522
|
+
"Validate on blur for best UX (after user leaves field)",
|
|
523
|
+
"Show specific, helpful error messages",
|
|
524
|
+
"Disable submit button during processing",
|
|
525
|
+
"Use appropriate input types for mobile keyboards",
|
|
526
|
+
"Enable autocomplete where appropriate",
|
|
527
|
+
"Provide clear focus indicators",
|
|
528
|
+
"Use fieldset and legend for radio/checkbox groups",
|
|
529
|
+
"Show progress for multi-step forms",
|
|
530
|
+
"Allow users to review before final submission",
|
|
531
|
+
"Provide clear success confirmation",
|
|
532
|
+
"Never lose user data on errors",
|
|
533
|
+
"Make buttons descriptive (not just 'Submit')",
|
|
534
|
+
"Support keyboard navigation throughout",
|
|
535
|
+
"Test with screen readers",
|
|
536
|
+
"Use HTTPS for all forms",
|
|
537
|
+
"Implement CSRF protection",
|
|
538
|
+
"Sanitize and validate on server"
|
|
539
|
+
],
|
|
540
|
+
"anti_patterns": [
|
|
541
|
+
"Using placeholder as label",
|
|
542
|
+
"No validation until submit",
|
|
543
|
+
"Generic error messages ('Invalid input')",
|
|
544
|
+
"Disabling paste in password fields",
|
|
545
|
+
"Clearing form on errors",
|
|
546
|
+
"Too many required fields",
|
|
547
|
+
"No visual feedback during submission",
|
|
548
|
+
"Confusing CAPTCHA implementations",
|
|
549
|
+
"Auto-advancing focus between fields",
|
|
550
|
+
"Hiding password requirements",
|
|
551
|
+
"Using dropdowns for few options (use radio buttons)",
|
|
552
|
+
"Not indicating required fields",
|
|
553
|
+
"Poor mobile keyboard support",
|
|
554
|
+
"No autofill/autocomplete",
|
|
555
|
+
"Asking for unnecessary information"
|
|
556
|
+
],
|
|
557
|
+
"form_types": {
|
|
558
|
+
"login_form": {
|
|
559
|
+
"fields": ["Email/username", "Password", "Remember me (optional)"],
|
|
560
|
+
"features": ["Show/hide password", "Forgot password link", "Social login options"],
|
|
561
|
+
"best_practices": [
|
|
562
|
+
"Simple and minimal",
|
|
563
|
+
"Show password toggle",
|
|
564
|
+
"Clear error messages",
|
|
565
|
+
"Forgot password prominent",
|
|
566
|
+
"Support autofill"
|
|
567
|
+
]
|
|
568
|
+
},
|
|
569
|
+
"registration_form": {
|
|
570
|
+
"fields": ["Email", "Password", "Confirm password", "Name"],
|
|
571
|
+
"features": ["Password strength indicator", "Terms acceptance", "Email verification"],
|
|
572
|
+
"best_practices": [
|
|
573
|
+
"Keep minimal (only essential fields)",
|
|
574
|
+
"Use progressive disclosure for optional info",
|
|
575
|
+
"Show password requirements upfront",
|
|
576
|
+
"Validate email format",
|
|
577
|
+
"Check username availability inline"
|
|
578
|
+
]
|
|
579
|
+
},
|
|
580
|
+
"checkout_form": {
|
|
581
|
+
"sections": ["Contact info", "Shipping address", "Payment method", "Review"],
|
|
582
|
+
"features": ["Address autocomplete", "Save info for later", "Order summary"],
|
|
583
|
+
"best_practices": [
|
|
584
|
+
"Show progress (multi-step)",
|
|
585
|
+
"Allow guest checkout",
|
|
586
|
+
"Save progress automatically",
|
|
587
|
+
"Show order summary throughout",
|
|
588
|
+
"Use address autocomplete",
|
|
589
|
+
"Support payment autofill",
|
|
590
|
+
"Clear error recovery"
|
|
591
|
+
]
|
|
592
|
+
},
|
|
593
|
+
"search_form": {
|
|
594
|
+
"simple": "<input type='search' placeholder='Search...'>",
|
|
595
|
+
"advanced": ["Filters", "Autocomplete", "Recent searches"],
|
|
596
|
+
"best_practices": [
|
|
597
|
+
"Prominent placement",
|
|
598
|
+
"Show search icon",
|
|
599
|
+
"Support Enter to submit",
|
|
600
|
+
"Show loading state",
|
|
601
|
+
"Display search suggestions",
|
|
602
|
+
"Handle no results gracefully"
|
|
603
|
+
]
|
|
604
|
+
},
|
|
605
|
+
"contact_form": {
|
|
606
|
+
"fields": ["Name", "Email", "Subject", "Message"],
|
|
607
|
+
"features": ["File attachment", "CAPTCHA", "Success confirmation"],
|
|
608
|
+
"best_practices": [
|
|
609
|
+
"Keep simple",
|
|
610
|
+
"Use textarea for message",
|
|
611
|
+
"Show character count",
|
|
612
|
+
"Email confirmation",
|
|
613
|
+
"Clear success message"
|
|
614
|
+
]
|
|
615
|
+
}
|
|
616
|
+
},
|
|
617
|
+
"security": {
|
|
618
|
+
"client_side": [
|
|
619
|
+
"Use HTTPS for all forms",
|
|
620
|
+
"Validate input format",
|
|
621
|
+
"Use autocomplete='off' for sensitive data",
|
|
622
|
+
"Implement rate limiting on submit",
|
|
623
|
+
"Clear sensitive data from memory"
|
|
624
|
+
],
|
|
625
|
+
"server_side": [
|
|
626
|
+
"Always validate on server (never trust client)",
|
|
627
|
+
"Sanitize all inputs",
|
|
628
|
+
"Use parameterized queries (prevent SQL injection)",
|
|
629
|
+
"Implement CSRF tokens",
|
|
630
|
+
"Hash passwords (bcrypt, Argon2)",
|
|
631
|
+
"Rate limit submissions",
|
|
632
|
+
"Log failed attempts"
|
|
633
|
+
],
|
|
634
|
+
"captcha": {
|
|
635
|
+
"when": "Login, registration, contact forms",
|
|
636
|
+
"types": ["reCAPTCHA", "hCaptcha", "Invisible CAPTCHA"],
|
|
637
|
+
"accessibility": "Provide audio alternative",
|
|
638
|
+
"ux": "Only after suspicious activity (not on first try)"
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
}
|