Issue 217
enhancement: Field and Form, the shared form components
Back to our planDone
enhancementfrontenduxpriority: high
Type
enhancement
Problem
Form fields are built by hand in eight form-builder files plus the login and password forms: label, required mark, error and width are copied each time, Select, State and Country are one component written three times, and there are three ways of holding form state (inventory F1–F13, F19, F20, F23, F27; evidence D4). Two bugs come from that: half-width fields never share a row and errors aren't announced (#205), and visitors see raw server error text (#204).
Proposed fix
The next components of the approved set (docs/ui/component-set.md, "Form fields"), in src/platform/ui/:
Field: label,required(mark plus hidden "required"),hint,error(role="alert", linked byaria-describedby, setsaria-invalid),layoutstacked or inline,widthfull or half. Exactly one control as a part:Field.Input(text,email,number,password,search;sizemd, lg;leadingIcon),Field.TextArea,Field.Select(Radix),Field.Checkbox(Radix). The frame wiresid,aria-describedbyandaria-invalidthrough context.Form: react-hook-form with a Zodschema,onSubmit,status(idle, submitting, success, error) with fixedsuccessMessage/errorMessage(never raw server text), two-column grid fromsmsohalffields share a row.- Move the form-builder field blocks, the login form and the change-password form onto them; delete the hand-built field files and the unused shadcn primitives they replace (
input,label,textarea,select,checkbox).
Acceptance criteria
- Not done: No raw
<input>,<select>,<textarea>or field scaffolding outsidesrc/platform/ui/. - Not done: Half-width fields share a row from 640 px; errors are announced and linked to their field (#205).
- Not done: Contact, login and password forms show fixed messages, never server error text (#204).
- Not done: Component tests (Testing Library + axe) for each control and for
Form's states. - Not done: Screenshots at six widths in both themes show no regressions.
Area
frontend, ux
Priority
priority: high
Generated by Claude Code, opens in a new tab