harmony-form-pattern
Build accessible healthcare forms using the Harmony Design System (@uhg-harmony/react). Provides component patterns, layout templates, and state management guidance for TextInput, DatePicker, Checkbox, Select, FormControl, and multi-step form flows. Use when creating React forms with Harmony components, fixing layout or accessibility issues, or scaffolding new healthcare intake forms.
Harmony Form Pattern Skill
You are an expert in building accessible healthcare forms with the Harmony Design System (@uhg-harmony/react). You produce clean, accessible, HIPAA-aware form UIs that follow Optum standards.
Review fetch https://storybook-harmony.ofp-elr.optum.com/
Core Principles
- Accessibility first — every field has
<Label>and optional<HelperText>; use<FormControl>for ARIA binding. - Controlled components — all inputs are driven by React
useState; no uncontrolled DOM state. - Prevent accidental submits — buttons use
type="button";<form>usesonSubmit={e => e.preventDefault()}. - Full-width layout — override Harmony container constraints with
style={{ width: '100%', maxWidth: 'none' }}. - Z-index awareness — date pickers and dropdowns need
position: relative; zIndex: 2on their parent column.
Component Reference
| Component | Purpose | Controlled Via |
|---|---|---|
<TextInput> | Single-line text entry | value + onChange={e => set(e.target.value)} |
<DatePicker> | Date selection with calendar popup | value + onChange={setValue} |
<Checkbox> | Boolean toggle | checked + onChange={e => set(e.target.checked)} |
<Select> | Dropdown selection | value + onChange={e => set(e.target.value)} |
<FormControl> | Accessibility wrapper (binds label to input) | id prop |
<Label> | Visible label for a field | Children text |
<HelperText> | Supplementary guidance below a field | Children text |
<Panel> | Card container with optional border/title | title, showBorder |
<Heading> | Section heading | level="h2" etc. |
<Button> | Action trigger | variant, type="button", onPress |
Layout System
Harmony uses a 12-column grid with utility classes:
.grid — grid container
.row — horizontal row
.col-{n} — column width (1-12)
.mt-{size} — margin-top (xs, s, m, l, xl)
Always wrap the grid in a full-width <div> to avoid Harmony's default max-width:
<div style={{ width: '100%', maxWidth: 'none', padding: '20px' }}>
<div className="grid" style={{ width: '100%', maxWidth: 'none' }}>
<div className="row">
<div className="col-6">…</div>
<div className="col-6">…</div>
</div>
</div>
</div>
Template Variants
Patient Intake Form (./templates/patient-intake-form.tsx)
Use when: You need a standard two-column intake or registration form with a mix of text, date, checkbox, and select inputs.
Components: Harmony + Panel + Heading + TextInput + DatePicker + Checkbox + Select + Button
Best for: Member intake, patient registration, or first-pass demographic capture.
Member Enrollment Form (./templates/member-enrollment-form.tsx)
Use when: You need a longer, multi-section form with inline validation and conditional fields.
Components: Harmony + Panel + section Headings + field controls + validation state + action buttons
Best for: Enrollment workflows, onboarding, or healthcare forms with grouped demographics, contact, and coverage sections.
Search Filter Bar (./templates/search-filter-bar.tsx)
Use when: You need a compact horizontal filter form for search and reporting views.
Components: Harmony + Panel + TextInput + Select + DatePicker + Button
Best for: Member lookup, claims search, queue filtering, or date-bounded dashboards.
Settings Form (./templates/settings-form.tsx)
Use when: You need a narrow single-column form for preferences or profile-style configuration.
Components: Harmony + Panel + Heading + TextInput + Select + Checkbox + Button
Best for: User settings, notification preferences, or lightweight admin configuration screens.
Usage
- Start from the template closest to the workflow instead of scaffolding from scratch.
- Keep labels explicit and add helper text where medical or coverage terminology may be ambiguous.
- Use full-width wrappers for dense enterprise forms unless the screen is intentionally narrow.
- Add
position: relativeand a raisedzIndexto columns that host popover-based controls likeDatePicker.
Templates
- ./templates/patient-intake-form.tsx
- ./templates/member-enrollment-form.tsx
- ./templates/search-filter-bar.tsx
- ./templates/settings-form.tsx
CSS Overrides For Full-Width Layout
Add these to your index.css when Harmony's default container constraints cause partial-width issues:
.harmony-container,
.harmony-panel,
.harmony-grid {
max-width: none !important;
width: 100% !important;
}
#root {
width: 100%;
min-height: 100vh;
}
Common Pitfalls
| Problem | Cause | Fix |
|---|---|---|
| Calendar popup hidden behind other elements | Missing z-index on parent column | Add style={{ position: 'relative', zIndex: 2 }} |
| Form clears on button click | Button has type="submit" | Use type="button" on all non-submit buttons |
| Form only fills part of viewport | Harmony container max-width | Add CSS overrides above; use maxWidth: 'none' inline |
| Select not updating | Wrong onChange signature | Use onChange={e => set(e.target.value)} |
| DatePicker not updating | Wrong onChange signature | DatePicker passes value directly: onChange={setValue} |
| Checkbox always checked | Using value instead of checked | Use checked={state} prop |
Related Assets
Harmony Components
Reference for Harmony Design System React components including buttons, modals, panels, form controls, navigation, and data display elements.
Owner: pcorazao
harmony-modal-pattern
Skill for implementing a Harmony modal pattern using Harmony Modal components.
Owner: pcorazao
Optum Harmony Healthcare Demo App
Create a Harmony-based example healthcare application that showcases eligibility, claims, and remittance concepts using current Harmony skills, instructions, navigation, forms, and components.
Owner: harmony-platform
harmony-app-layout-pattern
Skill for implementing a responsive app layout pattern using Harmony components.
Owner: pcorazao
harmony-create-simple-app
Recreate the Harmony healthcare demo application using exact page, shell, and mock-data templates captured from the working `harmony-healthcare-demo` reference app. Use when building a simple Harmony healthcare site with a dashboard, eligibility workflow, claims queue, remittance experience, and an official Harmony sidebar-based app shell.
Owner: pcorazao
Harmony Overview
Overview of the Harmony Design System — Optum's unified React component library combining UITK and UICL for building scalable, brand-compliant, and accessible healthcare web applications.
Owner: pcorazao

