Forms
FormField
A wrapper component for custom or native form inputs that provides consistent labeling, hints, and error states. Use when wrapping raw HTML inputs or third-party components.
Basic Usage
Wrap native HTML inputs with FormField for consistent styling and accessibility.
With Hints
Show hints as tooltips to provide additional context without cluttering the form.
With Descriptions
Provide longer explanatory text below the field.
With Errors
Display validation errors to guide users in correcting their input.
Size Variants
Adjust the label size to match form density requirements.
Disabled State
Apply disabled styling to indicate non-interactive fields.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
label * | string | — | Field label text |
required | boolean | false | Shows required indicator |
error | string | — | Error message to display |
hint | string | — | Helper text shown as tooltip |
description | string | — | Description text below the field |
id | string | — | ID for label association |
size | 'sm' | 'md' | 'lg' | 'md' | Label text size |
hideLabel | boolean | false | Visually hides label (still accessible) |
disabled | boolean | false | Applies disabled styling |
When to Use FormField
- • Use for wrapping native HTML inputs (
<input>,<select>,<textarea>) - • Use for third-party components that don't have built-in labels
- • For library components like
TextInput,Select, etc., use their built-inlabelprop instead - • Ensure the
idprop matches the input'sidfor proper label association
Healthcare Best Practices
- • Always mark PHI (Protected Health Information) fields appropriately
- • Use clear, descriptive labels that match medical terminology when appropriate
- • Provide hints for fields with specific format requirements (dates, IDs, phone numbers)
- • Display inline validation errors immediately after the user leaves a field
- • Use required indicators consistently throughout all forms
- • Ensure all fields have proper
idfor accessibility