Forms

TextInput

An enhanced, fully accessible text input with input masking, validation states, clearable button, password toggle, prefix/suffix support, and debounce. Essential for patient data entry in healthcare applications.

Basic Usage

Standard text inputs with labels for patient information forms.

Input Masking

Format input as users type with built-in mask presets for healthcare data. Use INPUT_MASKS constants for common patterns.

NPI Lookup with Debounce

Combine debounce with loading state for async validation like NPI registry lookups.

Try entering an NPI starting with "1" for a valid response, or any other digit for an error.

Clearable Input

Add a clear button for search fields and inputs that users frequently need to reset.

Password with Toggle

Allow users to toggle password visibility for easier entry while maintaining security.

Prefix & Suffix

Add static text before or after the input for currency, domains, or units. Prefix/suffix are displayed inside the input container for a clean, unified look.

Sizes

Choose appropriate sizes based on form density and importance.

Character Count

Use for fields with length limits like clinical notes or descriptions.

Disabled & Read-only

Use disabled for unavailable fields and read-only for view-only data.

Props

PropTypeDefaultDescription
label *stringInput label text
value string''Current input value (bindable)
type 'text' | 'email' | 'password' | 'tel' | 'url' | 'search' | 'number''text'Input type
error stringError message to display (shows red border and error icon)
successMessage stringSuccess message when valid (shows green border and check icon)
hint stringHelper text shown on focus
required booleanfalseMarks field as required
disabled booleanfalseDisables the input
readonly booleanfalseMakes input read-only
maxLength numberMaximum character length
showCharCount booleanfalseShows character counter
iconLeft SnippetLeft icon slot
iconRight SnippetRight icon slot (when not showing status)
size 'sm' | 'md' | 'lg''md'Input size
validateOnMount booleanfalseShow validation state immediately
mask stringInput mask pattern (# for digits, A for letters, * for alphanumeric)
maskPlaceholder stringCharacter to show for unfilled mask positions
maskIncludeLiterals booleanfalseInclude mask literals in value
clearable booleanfalseShow clear button when has value
showPasswordToggle booleanfalseShow password visibility toggle
prefix stringStatic text before input
suffix stringStatic text after input
loading booleanfalseShow loading spinner
debounce numberDebounce delay for oninput (ms)
ondebounce (value: string) => voidCalled with debounced value
onclear () => voidCalled when clear button is clicked

Available Mask Presets

ConstantPatternExample Output
INPUT_MASKS.PHONE_US(###) ###-####(555) 123-4567
INPUT_MASKS.SSN###-##-####123-45-6789
INPUT_MASKS.DATE_US##/##/####01/15/1990
INPUT_MASKS.DATE_ISO####-##-##1990-01-15
INPUT_MASKS.ZIP#####12345
INPUT_MASKS.ZIP_PLUS4#####-####12345-6789
INPUT_MASKS.NPI##########1234567890
INPUT_MASKS.MEMBER_ID_12############123456789012
INPUT_MASKS.CREDIT_CARD####-####-####-####4111-1111-1111-1111

Mask characters: # = digit, A = letter, * = alphanumeric. Any other character is treated as a literal.

Healthcare Best Practices

  • • Use input masking for SSN, phone, DOB, and NPI to ensure consistent formatting
  • • Always use inputMode="numeric" for masked numeric fields (set automatically when using mask)
  • • Use debounce + loading for async validation like NPI lookups or member ID verification
  • • Mark PHI fields appropriately and never log their values in production
  • • Add clearable for search fields to improve UX on mobile devices
  • • Use password toggle to help users avoid typos in authentication flows
  • • Provide clear error messages that help users correct their input

Accessibility Features

  • WAI-ARIA: Proper aria-invalid, aria-required, aria-describedby for validation
  • Keyboard Support: Escape to clear (when clearable), proper focus management
  • Screen Readers: Announces password visibility state, clear action, and validation messages
  • Clear Button: Not in tab order (tabindex=-1) - keyboard users use Backspace/Delete
  • Reduced Motion: Respects prefers-reduced-motion for animations
  • Touch Targets: 44x44px minimum for clear/toggle buttons