Field Component

A versatile base component for form input fields, providing comprehensive validation, formatting, and interaction capabilities. Supports various input types, custom styling, permissions, and advanced validation rules including length, pattern, custom, and range validations.


Overview

A versatile base component for form input fields, providing comprehensive validation, formatting, and interaction capabilities.

The Field Component serves as a foundation for form input elements, offering:

  • Comprehensive validation system with multiple validation types

  • Custom formatting capabilities

  • Interactive state management

  • Flexible styling options

  • Internationalization support


Validation Types

  • Length validation (minimum and maximum)

  • Pattern matching using regular expressions

  • Range validation for numeric values

  • Custom validation using JavaScript

  • Required field validation

  • Unique value validation


Properties

Property Name

Code

Type

Description

Enabled

enabled

boolean

Controls whether the field is interactive or disabled

Value

value

text

Current value of the input field

Formatted Value

formattedValue

text

Displayed value after formatting

Field Style

fieldStyle

text

Visual style of the field (flat, outlined, filled, borderless)

Validation

validation

text

Validation rules to apply (length, pattern, required, unique, range, custom)

Minimum Length

minLength

number

Minimum number of characters allowed

Maximum Length

maxLength

number

Maximum number of characters allowed

Validation Pattern

validationPattern

text

Regular expression pattern for validation

Pattern Validation Message

patternValidationMessage

multi-locale

Custom message for pattern validation failure

Custom Validation Script

customValidationScript

text

Custom JavaScript function for advanced validation

Custom Validation Message

customValidationMessage

multi-locale

Custom message for validation script failure

Placeholder

placeholder

multi-locale

Hint text displayed when the field is empty

Minimum Value

minimumValue

text

Minimum allowed value for range validation

Maximum Value

maximumValue

text

Maximum allowed value for range validation


Methods

Name

Description

getType()

Returns the input field type. Used to determine the appropriate rendering and behavior of the field

onValueChange(value, event)

Handles value change events and triggers associated actions. Manages formatting and validation of the new value

validate()

Performs comprehensive validation on the input field based on configured validation rules. Returns validation status and error messages if applicable


Events

Event Type

Name

Description

Focus Events

onFocus

Triggered when the field gains focus

Focus Events

onBlur

Triggered when the field loses focus

Value Events

onChange

Triggered when the field value changes