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

PropTypeDefaultDescription
label *stringField label text
required booleanfalseShows required indicator
error stringError message to display
hint stringHelper text shown as tooltip
description stringDescription text below the field
id stringID for label association
size 'sm' | 'md' | 'lg''md'Label text size
hideLabel booleanfalseVisually hides label (still accessible)
disabled booleanfalseApplies 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-in label prop instead
  • • Ensure the id prop matches the input's id for 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 id for accessibility