@equal-experts/kuat-react 0.13.0 → 0.14.0-beta.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.
Files changed (150) hide show
  1. package/agent-docs/AGENTS.md +10 -0
  2. package/agent-docs/README.md +17 -0
  3. package/agent-docs/bundle-manifest.json +55 -0
  4. package/agent-docs/components/_template.md +21 -0
  5. package/agent-docs/components/button-group.md +27 -0
  6. package/agent-docs/components/button.md +50 -0
  7. package/agent-docs/components/components.manifest.json +23 -0
  8. package/agent-docs/components/kuat-header.md +27 -0
  9. package/agent-docs/external/kuat-agent-rules/reference/accessibility/README.md +7 -0
  10. package/agent-docs/external/kuat-agent-rules/reference/accessibility/accessibility.md +446 -0
  11. package/agent-docs/external/kuat-agent-rules/reference/brand/README.md +9 -0
  12. package/agent-docs/external/kuat-agent-rules/reference/brand/brand.md +109 -0
  13. package/agent-docs/external/kuat-agent-rules/reference/brand/logo.md +152 -0
  14. package/agent-docs/external/kuat-agent-rules/reference/brand/voice-and-tone.md +166 -0
  15. package/agent-docs/external/kuat-agent-rules/reference/content/README.md +12 -0
  16. package/agent-docs/external/kuat-agent-rules/reference/content/formatting.md +120 -0
  17. package/agent-docs/external/kuat-agent-rules/reference/content/numbers.md +87 -0
  18. package/agent-docs/external/kuat-agent-rules/reference/content/punctuation.md +94 -0
  19. package/agent-docs/external/kuat-agent-rules/reference/content/writing-style.md +96 -0
  20. package/agent-docs/external/kuat-agent-rules/reference/design-language/README.md +11 -0
  21. package/agent-docs/external/kuat-agent-rules/reference/design-language/borders.md +160 -0
  22. package/agent-docs/external/kuat-agent-rules/reference/design-language/colours.md +201 -0
  23. package/agent-docs/external/kuat-agent-rules/reference/design-language/design-language.md +117 -0
  24. package/agent-docs/external/kuat-agent-rules/reference/design-language/spacing.md +131 -0
  25. package/agent-docs/external/kuat-agent-rules/reference/design-language/tokens/README.md +29 -0
  26. package/agent-docs/external/kuat-agent-rules/reference/design-language/tokens/colors.tokens.json +84 -0
  27. package/agent-docs/external/kuat-agent-rules/reference/design-language/typography.md +156 -0
  28. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-marketing/README.md +10 -0
  29. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-marketing/content/README.md +26 -0
  30. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-marketing/content/blog-posts.md +29 -0
  31. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-marketing/content/marketing-content.md +61 -0
  32. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-marketing/content/seo.md +40 -0
  33. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-marketing/emails.md +68 -0
  34. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-marketing/patterns/README.md +7 -0
  35. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-marketing/patterns/marketing-pages.md +368 -0
  36. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-marketing/website.md +154 -0
  37. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/README.md +16 -0
  38. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/accessibility.md +392 -0
  39. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/component-decision-tree.md +248 -0
  40. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/component-registry.md +49 -0
  41. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/content/README.md +29 -0
  42. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/content/actions.md +45 -0
  43. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/content/confirmations.md +51 -0
  44. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/content/empty-states.md +37 -0
  45. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/content/errors.md +48 -0
  46. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/content/forms.md +68 -0
  47. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/content/product-content.md +128 -0
  48. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/design.md +177 -0
  49. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/emails.md +65 -0
  50. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/patterns/README.md +10 -0
  51. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/patterns/authentication.md +303 -0
  52. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/patterns/dashboards.md +313 -0
  53. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/patterns/documentation.md +333 -0
  54. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/patterns/forms.md +361 -0
  55. package/agent-docs/kuat-docs/rules/README.md +155 -0
  56. package/agent-docs/kuat-docs/rules/design/layouts.md +394 -0
  57. package/agent-docs/kuat-docs/rules/scenarios/README.md +83 -0
  58. package/agent-docs/kuat-docs/rules/scenarios/authentication.md +301 -0
  59. package/agent-docs/kuat-docs/rules/scenarios/dashboards.md +314 -0
  60. package/agent-docs/kuat-docs/rules/scenarios/documentation.md +333 -0
  61. package/agent-docs/kuat-docs/rules/scenarios/forms.md +359 -0
  62. package/agent-docs/kuat-docs/rules/scenarios/marketing-pages.md +367 -0
  63. package/agent-docs/manifest.json +9 -0
  64. package/agent-docs/rules/LOADING-consumer.md +27 -0
  65. package/dist/accordion.d.ts +2 -0
  66. package/dist/alert-dialog.d.ts +2 -0
  67. package/dist/badge.d.ts +3 -0
  68. package/dist/button-group.d.ts +2 -0
  69. package/dist/button.d.ts +3 -0
  70. package/dist/carousel.d.ts +2 -0
  71. package/dist/checkbox.d.ts +3 -0
  72. package/dist/components/ui/accordion/accordion.d.ts +7 -0
  73. package/dist/components/ui/accordion/index.d.ts +1 -0
  74. package/dist/components/ui/alert-dialog/alert-dialog.d.ts +20 -0
  75. package/dist/components/ui/alert-dialog/index.d.ts +1 -0
  76. package/dist/components/ui/badge/badge.d.ts +16 -0
  77. package/dist/components/ui/badge/index.d.ts +2 -0
  78. package/dist/components/ui/breadcrumb/Breadcrumb.d.ts +29 -0
  79. package/dist/components/ui/breadcrumb/breadcrumb-primitives.d.ts +19 -0
  80. package/dist/components/ui/breadcrumb/index.d.ts +4 -0
  81. package/dist/components/ui/button/button.d.ts +27 -0
  82. package/dist/components/ui/button/index.d.ts +2 -0
  83. package/dist/components/ui/button-group/button-group.d.ts +23 -0
  84. package/dist/components/ui/button-group/index.d.ts +2 -0
  85. package/dist/components/ui/carousel/carousel.d.ts +50 -0
  86. package/dist/components/ui/carousel/index.d.ts +2 -0
  87. package/dist/components/ui/checkbox/checkbox-field.d.ts +23 -0
  88. package/dist/components/ui/checkbox/checkbox.d.ts +5 -0
  89. package/dist/components/ui/checkbox/index.d.ts +4 -0
  90. package/dist/components/ui/content-card/content-card.d.ts +29 -0
  91. package/dist/components/ui/content-card/index.d.ts +2 -0
  92. package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts +27 -0
  93. package/dist/components/ui/dropdown-menu/index.d.ts +1 -0
  94. package/dist/components/ui/ee-logo-icon/ee-logo-icon.d.ts +11 -0
  95. package/dist/components/ui/ee-logo-icon/index.d.ts +2 -0
  96. package/dist/components/ui/field/field.d.ts +28 -0
  97. package/dist/components/ui/field/index.d.ts +2 -0
  98. package/dist/components/ui/icon-button/icon-button.d.ts +27 -0
  99. package/dist/components/ui/icon-button/index.d.ts +2 -0
  100. package/dist/components/ui/input/index.d.ts +2 -0
  101. package/dist/components/ui/input/input.d.ts +20 -0
  102. package/dist/components/ui/kuat-carousel/index.d.ts +2 -0
  103. package/dist/components/ui/kuat-carousel/kuat-carousel.d.ts +16 -0
  104. package/dist/components/ui/kuat-header/index.d.ts +4 -0
  105. package/dist/components/ui/kuat-header/kuat-header.d.ts +16 -0
  106. package/dist/components/ui/kuat-header/kuat-header.logic.d.ts +32 -0
  107. package/dist/components/ui/kuat-header/kuat-header.types.d.ts +91 -0
  108. package/dist/components/ui/kuat-logo-lockup/index.d.ts +2 -0
  109. package/dist/components/ui/kuat-logo-lockup/kuat-logo-lockup.d.ts +17 -0
  110. package/dist/components/ui/kuat-radial-progress/index.d.ts +2 -0
  111. package/dist/components/ui/kuat-radial-progress/kuat-radial-progress.d.ts +16 -0
  112. package/dist/components/ui/radio/index.d.ts +4 -0
  113. package/dist/components/ui/radio/radio-field.d.ts +25 -0
  114. package/dist/components/ui/radio/radio.d.ts +7 -0
  115. package/dist/components/ui/select/constants.d.ts +19 -0
  116. package/dist/components/ui/select/index.d.ts +3 -0
  117. package/dist/components/ui/select/select.d.ts +53 -0
  118. package/dist/components/ui/separator/index.d.ts +2 -0
  119. package/dist/components/ui/separator/separator.d.ts +9 -0
  120. package/dist/components/ui/sonner/index.d.ts +4 -0
  121. package/dist/components/ui/sonner/sonner-content.d.ts +15 -0
  122. package/dist/components/ui/sonner/sonner.d.ts +21 -0
  123. package/dist/components/ui/switch/index.d.ts +4 -0
  124. package/dist/components/ui/switch/switch-field.d.ts +23 -0
  125. package/dist/components/ui/switch/switch.d.ts +5 -0
  126. package/dist/components/ui/textarea/index.d.ts +2 -0
  127. package/dist/components/ui/textarea/textarea.d.ts +9 -0
  128. package/dist/components/ui/toggle/constants.d.ts +4 -0
  129. package/dist/components/ui/toggle/index.d.ts +6 -0
  130. package/dist/components/ui/toggle/toggle-group.d.ts +11 -0
  131. package/dist/components/ui/toggle/toggle.d.ts +9 -0
  132. package/dist/field.d.ts +3 -0
  133. package/dist/icon-button.d.ts +3 -0
  134. package/dist/index.d.ts +47 -0
  135. package/dist/input.d.ts +3 -0
  136. package/dist/kuat-carousel.d.ts +2 -0
  137. package/dist/kuat-radial-progress.d.ts +7 -0
  138. package/dist/lib/react-node-compat.d.ts +7 -0
  139. package/dist/lib/utils.d.ts +3 -0
  140. package/dist/radio.d.ts +3 -0
  141. package/dist/select.d.ts +3 -0
  142. package/dist/sonner.d.ts +1 -0
  143. package/dist/style.css +1 -1
  144. package/dist/style.css.d.ts +2 -0
  145. package/dist/switch.d.ts +1 -0
  146. package/dist/test/setup.d.ts +1 -0
  147. package/dist/textarea.d.ts +3 -0
  148. package/dist/toggle-group.d.ts +3 -0
  149. package/dist/toggle.d.ts +3 -0
  150. package/package.json +4 -2
@@ -0,0 +1,333 @@
1
+ # Documentation Scenarios
2
+
3
+ Patterns for documentation sites, knowledge bases, API references, and content-heavy pages.
4
+
5
+ ---
6
+
7
+ ## Principles
8
+
9
+ ### User Goals
10
+
11
+ - **Find information quickly** - Search and navigate efficiently
12
+ - **Understand content** - Clear, well-structured explanations
13
+ - **Complete tasks** - Step-by-step guidance that works
14
+ - **Stay oriented** - Know where they are and where to go next
15
+
16
+ ### UX Principles
17
+
18
+ | Principle | Implementation |
19
+ |-----------|----------------|
20
+ | Clear structure | Logical hierarchy, consistent organisation |
21
+ | Scannable content | Headings, lists, code blocks |
22
+ | Multiple paths | Search, navigation, breadcrumbs |
23
+ | Progressive detail | Overview first, details on demand |
24
+
25
+ ### Success Metrics
26
+
27
+ - Search effectiveness (found what they needed)
28
+ - Time to find information
29
+ - Page bounce rate
30
+ - Task completion rate (for tutorials)
31
+
32
+ ---
33
+
34
+ ## Layout
35
+
36
+ **Base Layout:** Sidebar Navigation + Split Layout
37
+
38
+ Documentation uses a three-column layout on desktop:
39
+
40
+ ### Docs Landing Page
41
+
42
+ Use Horizontal Navigation:
43
+
44
+ ```
45
+ ┌─────────────────────────────────────┐
46
+ │ Header: Logo + Main Nav │
47
+ ├─────────────────────────────────────┤
48
+ │ Hero: Docs title + Search │
49
+ ├─────────────────────────────────────┤
50
+ │ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ │
51
+ │ │Cat 1│ │Cat 2│ │Cat 3│ │Cat 4│ │
52
+ │ └─────┘ └─────┘ └─────┘ └─────┘ │
53
+ ├─────────────────────────────────────┤
54
+ │ Popular Articles │
55
+ ├─────────────────────────────────────┤
56
+ │ Footer │
57
+ └─────────────────────────────────────┘
58
+ ```
59
+
60
+ ### Docs Content Page
61
+
62
+ Use Sidebar + Split (three-column):
63
+
64
+ ```
65
+ ┌──────┬──────────────────────────────────┐
66
+ │ Nav │ Breadcrumbs [Search] │
67
+ │ Side ├──────────────────────────────────┤
68
+ │ bar │ ┌───────────┐ │
69
+ │ │ # Page Title │ On This │ │
70
+ │ │ │ Page │ │
71
+ │ [Doc │ Content... │ - Section │ │
72
+ │ tree]│ │ - Section │ │
73
+ │ │ ## Section │ - Section │ │
74
+ │ │ Content... └───────────┘ │
75
+ │ │ │
76
+ │ │ [Previous] [Next →] │
77
+ └──────┴──────────────────────────────────┘
78
+ ```
79
+
80
+ ### Specifications
81
+
82
+ | Element | Value |
83
+ |---------|-------|
84
+ | Left sidebar width | 240-280px |
85
+ | Right sidebar (TOC) | 200-240px |
86
+ | Content max-width | 800px (prose) |
87
+ | Content padding | 32-48px |
88
+
89
+ ---
90
+
91
+ ## Design
92
+
93
+ ### Color Tokens
94
+
95
+ | Element | Token |
96
+ |---------|-------|
97
+ | Page background | `bg-background` |
98
+ | Left sidebar | `bg-sidebar` (dark) or `bg-muted` (light) |
99
+ | Right sidebar | `bg-background` (transparent) |
100
+ | Code blocks | `bg-muted` |
101
+ | Inline code | `bg-muted` |
102
+ | Links | `text-primary` |
103
+
104
+ ### Typography
105
+
106
+ | Element | Style |
107
+ |---------|-------|
108
+ | Page title (H1) | `text-3xl font-bold` |
109
+ | Section heading (H2) | `text-2xl font-semibold` |
110
+ | Subsection (H3) | `text-xl font-semibold` |
111
+ | Body text | `text-base` with `leading-7` |
112
+ | Code | `font-mono text-sm` |
113
+ | Sidebar nav | `text-sm` |
114
+
115
+ ### Navigation Sidebar
116
+
117
+ | Element | Specification |
118
+ |---------|---------------|
119
+ | Background | `bg-sidebar` (dark) or `bg-muted` (light) |
120
+ | Active item | Left border or background highlight |
121
+ | Section headers | Bold, no link |
122
+ | Page links | Normal weight |
123
+ | Sub-pages | Indented, smaller text |
124
+ | Scroll | Independent from content |
125
+
126
+ ### Table of Contents (Right)
127
+
128
+ | Element | Specification |
129
+ |---------|---------------|
130
+ | Position | Sticky, offset for header |
131
+ | Content | H2 and H3 headings from page |
132
+ | Active tracking | Highlight current section on scroll |
133
+ | Visibility | Hide below 1280px |
134
+
135
+ ---
136
+
137
+ ## Content
138
+
139
+ ### Page Structure
140
+
141
+ ```markdown
142
+ # Page Title ← H1, one per page
143
+
144
+ Intro paragraph ← No heading, describes page purpose
145
+
146
+ ## Major Section ← H2, main divisions
147
+
148
+ ### Subsection ← H3, within sections
149
+
150
+ #### Detail ← H4, use sparingly
151
+ ```
152
+
153
+ ### Navigation Hierarchy
154
+
155
+ ```
156
+ Getting Started ← Category (bold, not clickable)
157
+ Introduction ← Page link
158
+ Installation ← Page link (active)
159
+ Quick Start ← Page link
160
+ Components ← Category
161
+ Button ← Page link
162
+ Variants ← Sub-page (indented)
163
+ Examples ← Sub-page
164
+ ```
165
+
166
+ ### Breadcrumbs
167
+
168
+ ```
169
+ Docs / Components / Button / Variants
170
+ ```
171
+
172
+ - Show full path to current page
173
+ - All items clickable except current
174
+ - Truncate middle items on mobile if needed
175
+
176
+ ### Previous/Next Navigation
177
+
178
+ ```
179
+ ┌─────────────────────────────────────────┐
180
+ │ ← Previous Next → │
181
+ │ Installation Quick Start │
182
+ └─────────────────────────────────────────┘
183
+ ```
184
+
185
+ - Full width bar at bottom of content
186
+ - Based on sidebar navigation order
187
+ - Show page titles, not just "Previous/Next"
188
+
189
+ ---
190
+
191
+ ## Accessibility
192
+
193
+ **Base requirements:** See [accessibility foundations](../../../accessibility/accessibility.md) and [web accessibility](../accessibility.md)
194
+
195
+ **Scenario-specific:**
196
+
197
+ | Requirement | Implementation |
198
+ |-------------|----------------|
199
+ | Heading hierarchy | Proper H1 → H2 → H3 sequence |
200
+ | Skip links | Skip to main content, skip navigation |
201
+ | Landmark regions | nav, main, complementary (TOC) |
202
+ | Search keyboard | Cmd/Ctrl+K shortcut, accessible modal |
203
+ | Code blocks | Scrollable with keyboard, screen reader context |
204
+ | Multiple nav labels | `aria-label` to distinguish left vs right sidebars |
205
+
206
+ ### Code Blocks
207
+
208
+ - Ensure code blocks are keyboard scrollable
209
+ - Provide language context for screen readers
210
+ - Copy button must be keyboard accessible
211
+ - Don't rely on syntax highlighting alone for meaning
212
+
213
+ ---
214
+
215
+ ## Implementation
216
+
217
+ ### Code Block Patterns
218
+
219
+ **Inline Code:**
220
+
221
+ - Use for: function names, file paths, short values
222
+ - Style: `bg-muted`, `font-mono`, `text-sm`, `rounded`
223
+
224
+ **Code Blocks:**
225
+
226
+ | Element | Specification |
227
+ |---------|---------------|
228
+ | Background | `bg-muted` or syntax theme |
229
+ | Border radius | 6px |
230
+ | Padding | 16px |
231
+ | Font | JetBrains Mono or system mono |
232
+ | Line numbers | Optional, for reference |
233
+ | Copy button | Top-right corner |
234
+ | Language label | Top-left or top-right |
235
+
236
+ **Multi-file Examples (Tabs):**
237
+
238
+ ```
239
+ ┌─────────────────────────────────────┐
240
+ │ [React] [Vue] [HTML] │
241
+ ├─────────────────────────────────────┤
242
+ │ // Code for selected tab │
243
+ │ ... │
244
+ └─────────────────────────────────────┘
245
+ ```
246
+
247
+ - Tabs for framework variants
248
+ - Preserve selection across page navigation
249
+ - Accessible tab panel pattern
250
+
251
+ ### Search Patterns
252
+
253
+ **Search Bar:**
254
+
255
+ - Prominent on landing page (hero area)
256
+ - Persistent in header on content pages
257
+ - Keyboard shortcut indicator (Cmd+K or Ctrl+K)
258
+
259
+ **Search Results:**
260
+
261
+ - Show in modal/overlay
262
+ - Group by section/category
263
+ - Highlight matching text
264
+ - Keyboard navigation (arrows + enter)
265
+ - Recent searches
266
+
267
+ ### Table of Contents Behavior
268
+
269
+ | Behavior | Implementation |
270
+ |----------|----------------|
271
+ | Active tracking | Highlight section in viewport |
272
+ | Click to scroll | Smooth scroll to section |
273
+ | Sticky position | Stay visible while scrolling |
274
+ | Hide on small screens | Below 1280px |
275
+ | Collapse | Optionally collapsible |
276
+
277
+ ### Responsive Behavior
278
+
279
+ | Breakpoint | Left Sidebar | Content | Right Sidebar |
280
+ |------------|--------------|---------|---------------|
281
+ | Mobile | Drawer (hidden) | Full width | Hidden |
282
+ | Tablet | Collapsible | Full width | Hidden |
283
+ | Desktop | Visible (240px) | Centered (max 800px) | Visible (200px) |
284
+
285
+ ---
286
+
287
+ ## Best Practices
288
+
289
+ ### Do's
290
+
291
+ 1. **Use descriptive headings** - Enable scanning and navigation
292
+ 2. **Keep pages focused** - One topic per page
293
+ 3. **Show code examples** - Demonstrate, don't just describe
294
+ 4. **Maintain consistency** - Same structure across all pages
295
+ 5. **Update with product** - Keep docs in sync with code
296
+ 6. **Provide multiple paths** - Search, nav, links, breadcrumbs
297
+
298
+ ### Don'ts
299
+
300
+ 1. **Don't write walls of text** - Break into sections
301
+ 2. **Don't assume knowledge** - Define terms, link to prereqs
302
+ 3. **Don't hide important info** - Key points should be scannable
303
+ 4. **Don't let docs go stale** - Regular review and updates
304
+ 5. **Don't break links** - Use redirects when restructuring
305
+
306
+ ### Common Mistakes
307
+
308
+ | Mistake | Solution |
309
+ |---------|----------|
310
+ | No search | Add prominent search functionality |
311
+ | Deep nesting | Flatten hierarchy, max 3 levels |
312
+ | Missing navigation | Add prev/next, breadcrumbs |
313
+ | Inconsistent structure | Template for all pages |
314
+ | No code examples | Add runnable examples |
315
+ | Outdated content | Version docs, review process |
316
+
317
+ ### Edge Cases
318
+
319
+ | Case | Handling |
320
+ |------|----------|
321
+ | Very long pages | Add TOC, consider splitting |
322
+ | Multi-version docs | Version switcher, clear indicators |
323
+ | API reference | Auto-generate from code, consistent format |
324
+ | External links | Mark with icon, open in new tab |
325
+ | Deprecated content | Clear warnings, link to current |
326
+
327
+ ---
328
+
329
+ ## Related Documentation
330
+
331
+ - [Product Design](../design.md) - Sidebar and Split layouts
332
+ - [Accessibility foundations](../../../accessibility/accessibility.md) - Structure and headings
333
+ - [Typography](../../../design-language/typography.md) - Type scale and hierarchy
@@ -0,0 +1,361 @@
1
+ # Form Scenarios
2
+
3
+ Patterns for forms, settings pages, multi-step wizards, and data entry interfaces.
4
+
5
+ ---
6
+
7
+ ## Principles
8
+
9
+ ### User Goals
10
+
11
+ - **Complete task efficiently** - Minimal friction to submission
12
+ - **Understand requirements** - Clear what's needed and why
13
+ - **Correct mistakes easily** - Fix errors without re-entering data
14
+ - **Save progress** - Don't lose work unexpectedly
15
+
16
+ ### UX Principles
17
+
18
+ | Principle | Implementation |
19
+ |-----------|----------------|
20
+ | Minimal friction | Only ask for necessary information |
21
+ | Clear expectations | Explain what each field needs |
22
+ | Helpful feedback | Specific, actionable error messages |
23
+ | Progress preservation | Save work, confirm destructive actions |
24
+
25
+ ### Success Metrics
26
+
27
+ - Form completion rate
28
+ - Time to complete
29
+ - Error rate and recovery
30
+ - Abandonment rate
31
+
32
+ ---
33
+
34
+ ## Layout
35
+
36
+ **Base Layout:** Varies by context
37
+
38
+ | Context | Recommended Layout |
39
+ |---------|-------------------|
40
+ | Public forms (contact, signup) | Single Column |
41
+ | App settings | Sidebar Navigation |
42
+ | Multi-step wizards | Single Column or Horizontal Navigation |
43
+ | Inline editing | Within parent layout |
44
+
45
+ ### Card-Based Form (Settings, Profile)
46
+
47
+ ```
48
+ ┌─────────────────────────────────────┐
49
+ │ Card Header: Section Title │
50
+ ├─────────────────────────────────────┤
51
+ │ Form Fields │
52
+ │ ... │
53
+ ├─────────────────────────────────────┤
54
+ │ Card Footer: [Cancel] [Save] │
55
+ └─────────────────────────────────────┘
56
+ ```
57
+
58
+ ### Multi-Step Wizard
59
+
60
+ ```
61
+ ┌─────────────────────────────────────┐
62
+ │ Progress: ●───●───○───○ │
63
+ ├─────────────────────────────────────┤
64
+ │ Step Title │
65
+ │ Step description │
66
+ ├─────────────────────────────────────┤
67
+ │ │
68
+ │ Form Fields for Current Step │
69
+ │ │
70
+ ├─────────────────────────────────────┤
71
+ │ [Back] [Next →] │
72
+ └─────────────────────────────────────┘
73
+ ```
74
+
75
+ ### Specifications
76
+
77
+ | Element | Value |
78
+ |---------|-------|
79
+ | Form card max-width | 600px (single-column forms) |
80
+ | Card padding | 24px (`p-6`) |
81
+ | Field spacing | 24px (`space-y-6`) |
82
+ | Section spacing | 32px between cards |
83
+ | Settings page max-width | 800px |
84
+
85
+ ---
86
+
87
+ ## Design
88
+
89
+ ### Color Tokens
90
+
91
+ | Element | Token |
92
+ |---------|-------|
93
+ | Card background | `bg-card` |
94
+ | Card border | `border` |
95
+ | Input background | `bg-background` |
96
+ | Input border | `border-input` |
97
+ | Input focus | `ring-ring` |
98
+ | Error state | `border-destructive`, `text-destructive` |
99
+ | Success indicator | `text-green-600` |
100
+
101
+ ### Typography
102
+
103
+ | Element | Style |
104
+ |---------|-------|
105
+ | Section title | `text-lg font-semibold` |
106
+ | Section description | `text-sm text-muted-foreground` |
107
+ | Field label | `text-sm font-medium` |
108
+ | Input text | `text-base` |
109
+ | Helper text | `text-sm text-muted-foreground` |
110
+ | Error text | `text-sm text-destructive` |
111
+ | Required indicator | `text-destructive` (asterisk) |
112
+
113
+ ### Spacing
114
+
115
+ | Element | Value |
116
+ |---------|-------|
117
+ | Label to input | 8px |
118
+ | Input to helper/error | 4px |
119
+ | Between fields | 24px |
120
+ | Button group gap | 16px |
121
+
122
+ ---
123
+
124
+ ## Content
125
+
126
+ ### Field Labels
127
+
128
+ | Requirement | Example |
129
+ |-------------|---------|
130
+ | Clear and specific | "Email address" not "Email" |
131
+ | Required indicator | "Email address *" |
132
+ | Optional indicator | "Phone number (optional)" |
133
+
134
+ ### Helper Text
135
+
136
+ Use to:
137
+ - Explain format requirements
138
+ - Provide examples
139
+ - Clarify why information is needed
140
+
141
+ ```
142
+ Email address *
143
+ [ ]
144
+ We'll send your receipt to this address.
145
+ ```
146
+
147
+ ### Error Messages
148
+
149
+ | Quality | Bad | Good |
150
+ |---------|-----|------|
151
+ | Specific | "Invalid input" | "Email must include @ symbol" |
152
+ | Actionable | "Error" | "Please enter a valid date (DD/MM/YYYY)" |
153
+ | Polite | "Wrong!" | "Please check this field" |
154
+
155
+ ### Button Labels
156
+
157
+ | Action | Label |
158
+ |--------|-------|
159
+ | Submit form | "Save changes", "Submit", "Create account" |
160
+ | Go to next step | "Next", "Continue" |
161
+ | Go back | "Back", "Previous" |
162
+ | Cancel | "Cancel", "Discard changes" |
163
+ | Delete | "Delete", "Remove" |
164
+
165
+ ---
166
+
167
+ ## Accessibility
168
+
169
+ **Base requirements:** See [accessibility foundations](../../../accessibility/accessibility.md) and [web accessibility](../accessibility.md)
170
+
171
+ **Scenario-specific:**
172
+
173
+ | Requirement | Implementation |
174
+ |-------------|----------------|
175
+ | Labels | Every input has visible, associated `<label>` |
176
+ | Required fields | Marked with asterisk AND `aria-required` |
177
+ | Error linking | Errors linked via `aria-describedby` |
178
+ | Error summary | Summary at top with links to fields |
179
+ | Focus management | Focus first error after failed submission |
180
+ | No time limits | Allow unlimited time (or generous extension) |
181
+
182
+ ### Form Validation Pattern
183
+
184
+ **Critical: Validate on submit, not on blur**
185
+
186
+ | Rule | Implementation |
187
+ |------|----------------|
188
+ | Validate on submit | Show all errors after form submission |
189
+ | Never disable submit | Users can always attempt submission |
190
+ | No blur validation | Don't show errors while user is typing |
191
+ | Error summary | Show summary above form with field links |
192
+ | Focus first error | Move focus to first invalid field |
193
+
194
+ ### Grouping
195
+
196
+ Use `<fieldset>` and `<legend>` for:
197
+ - Radio button groups
198
+ - Checkbox groups
199
+ - Related fields (e.g., address components)
200
+
201
+ ---
202
+
203
+ ## Implementation
204
+
205
+ ### Field Layout Patterns
206
+
207
+ **Vertical (Default):**
208
+
209
+ ```
210
+ Label
211
+ [Input field ]
212
+ Helper text or error
213
+ ```
214
+
215
+ Best for: Most forms, mobile-first
216
+
217
+ **Horizontal (Settings):**
218
+
219
+ ```
220
+ Label [Input field ]
221
+ Description text
222
+ ```
223
+
224
+ Best for: Settings pages with many fields
225
+
226
+ **Grid (Related Fields):**
227
+
228
+ ```
229
+ [First Name ] [Last Name ]
230
+ [Email ]
231
+ [Phone ] [Extension ]
232
+ ```
233
+
234
+ Best for: Related fields (names, addresses)
235
+
236
+ ### Button Placement
237
+
238
+ **Component guide:** `shadcn:button` — the `components/button.md` guide for button behaviour lives in the consumer package `agent-docs/` or overlay (see [component-registry.md](../component-registry.md)).
239
+
240
+ **Single Form:**
241
+
242
+ | Position | Button | Variant |
243
+ |----------|--------|---------|
244
+ | Right | Submit/Save | `variant="default"` (primary) |
245
+ | Left of submit | Cancel | `variant="outline"` or `ghost` |
246
+ | Far left or separate | Delete | `variant="destructive"` |
247
+
248
+ **Form in Modal:**
249
+
250
+ | Position | Button |
251
+ |----------|--------|
252
+ | Left | Cancel |
253
+ | Right | Submit |
254
+
255
+ **Multi-step Wizard:**
256
+
257
+ | Position | Button |
258
+ |----------|--------|
259
+ | Left | Back (`variant="outline"`) |
260
+ | Right | Next/Submit (`variant="default"`) |
261
+
262
+ ### Settings Page Pattern
263
+
264
+ Multiple card sections, each independently saveable:
265
+
266
+ ```
267
+ ┌─ Profile Information ───────────────┐
268
+ │ [Fields...] │
269
+ │ [Save] │
270
+ └─────────────────────────────────────┘
271
+ ↓ 32px gap
272
+ ┌─ Notification Preferences ──────────┐
273
+ │ [Fields...] │
274
+ │ [Save] │
275
+ └─────────────────────────────────────┘
276
+ ```
277
+
278
+ | Element | Specification |
279
+ |---------|---------------|
280
+ | Section gap | 32px |
281
+ | Section max-width | 800px |
282
+ | Alignment | Left-aligned (not centered) |
283
+
284
+ ### Multi-Step Wizard Pattern
285
+
286
+ **Progress Indicator:**
287
+
288
+ - Show step numbers or names
289
+ - Highlight: completed, current, upcoming
290
+ - Allow clicking completed steps to go back
291
+
292
+ **Step Transitions:**
293
+
294
+ - Validate current step before "Next"
295
+ - Show summary on final step before submit
296
+ - Preserve data when going back
297
+
298
+ **State Management:**
299
+
300
+ - Save progress to prevent data loss
301
+ - Warn before leaving with unsaved changes
302
+ - Handle session timeout gracefully
303
+
304
+ ### Responsive Behavior
305
+
306
+ | Breakpoint | Grid Fields | Button Layout |
307
+ |------------|-------------|---------------|
308
+ | Mobile | Stack to single column | Stack vertically |
309
+ | Tablet | 2 columns | Horizontal |
310
+ | Desktop | As designed | Horizontal |
311
+
312
+ ---
313
+
314
+ ## Best Practices
315
+
316
+ ### Do's
317
+
318
+ 1. **Ask only what's needed** - Every field should be justified
319
+ 2. **Group related fields** - Logical sections aid completion
320
+ 3. **Show progress** - Especially for long/multi-step forms
321
+ 4. **Preserve input** - Never clear on error
322
+ 5. **Confirm success** - Toast, redirect, or inline confirmation
323
+ 6. **Autosave where possible** - Drafts, settings
324
+
325
+ ### Don'ts
326
+
327
+ 1. **Don't validate on blur** - Interrupts user flow
328
+ 2. **Don't disable submit** - Users should always try
329
+ 3. **Don't use placeholders as labels** - They disappear
330
+ 4. **Don't require confirmation for simple saves** - Only for destructive actions
331
+ 5. **Don't hide required indicators** - Make them obvious
332
+
333
+ ### Common Mistakes
334
+
335
+ | Mistake | Solution |
336
+ |---------|----------|
337
+ | Disabling submit button | Keep enabled, show errors on submit |
338
+ | Blur validation | Validate on submit only |
339
+ | Placeholder-only labels | Always use visible labels |
340
+ | Vague errors | Specific, actionable messages |
341
+ | No error summary | Add summary at top with links |
342
+ | Clearing form on error | Preserve all user input |
343
+
344
+ ### Edge Cases
345
+
346
+ | Case | Handling |
347
+ |------|----------|
348
+ | Very long forms | Break into steps or sections |
349
+ | Conditional fields | Show/hide smoothly, don't lose data |
350
+ | File uploads | Show progress, handle failures |
351
+ | Unsaved changes | Warn before navigation |
352
+ | Session timeout | Save draft, prompt re-auth |
353
+ | Network failure | Queue submission, retry automatically |
354
+
355
+ ---
356
+
357
+ ## Related Documentation
358
+
359
+ - [Product Design](../design.md) - Layout options
360
+ - [Web Accessibility](../accessibility.md) - Form validation pattern
361
+ - [Authentication Pattern](./authentication.md) - Login/registration forms