Form
Form container with validation, paired with `TxFormItem` for consistent layout and messages.
Form
Form container with validation, paired with TxFormItem for consistent layout and messages.
Basic Usage
Demo loads on client.
API
TxForm Props
| Name | Type | Default | Description |
|---|---|---|---|
model | Record<string, any> | - | Form data |
rules | FormRules | - | Validation rules |
labelPosition | 'left' | 'right' | 'top' | 'left' | Label position |
labelWidth | string | number | - | Label width |
size | 'small' | 'medium' | 'large' | 'medium' | Form size |
disabled | boolean | false | Disable form |
TxForm Events
| Event | Payload | Description |
|---|---|---|
validate | (valid: boolean) | Validation result |
TxFormItem Props
| Name | Type | Default | Description |
|---|---|---|---|
label | string | '' | Label text |
prop | string | - | Target field |
rules | FormRule | FormRule[] | - | Custom rules |
required | boolean | false | Required flag |
showMessage | boolean | true | Show error message |
inline | boolean | false | Inline layout |
TxFormItem Events
| Event | Payload | Description |
|---|---|---|
validate | (valid: boolean) | Field validation result |
Expose
| Name | Description |
|---|---|
validate() | Trigger form validation |
resetFields() | Reset all fields |
clearValidate() | Clear validation state |
Was this helpful?