Skip to content
SprecherEast
Issue 217

enhancement: Field and Form, the shared form components

Back to our plan
Done
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 by aria-describedby, sets aria-invalid), layout stacked or inline, width full or half. Exactly one control as a part: Field.Input (text, email, number, password, search; size md, lg; leadingIcon), Field.TextArea, Field.Select (Radix), Field.Checkbox (Radix). The frame wires id, aria-describedby and aria-invalid through context.
  • Form: react-hook-form with a Zod schema, onSubmit, status (idle, submitting, success, error) with fixed successMessage/errorMessage (never raw server text), two-column grid from sm so half fields 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 outside src/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

See it on GitHub, opens in a new tab