Unions

The following unions are available in the Form component:

NameValueDescription
FormValueType
'string' | 'number' | 'boolean' | 'Date' | 'File' | 'FileList' | 'React.ReactNode' | 'null' | 'undefined'

Specifies the possible value types for form fields.

ValidationRule
'['boolean' | 'RegExp' | 'number' | 'number[]' | 'string' | 'Date' | '(() => boolean), string?']'

Defines the structure for a validation rule in the form system. A ValidationRule is a two-part array containing:

  • A validation condition (as boolean, RegExp, number, function, etc.)
  • An optional custom error message to show when validation fails

The first element's type depends on the specific rule:

  • For boolean rules (like 'required'): true/false
  • For pattern rules (like 'email', 'regex'): RegExp object
  • For range rules: number or number[] (min/max values)
  • For equality checks: string (field name to compare with)
  • For custom validation: () => boolean function
const requiredRule: ValidationRule = [true, 'This field is required'];