Skip to content

A2TextField

Form field component with label and input.

Props

PropertyTypeDefaultDescription
labelstring-Field label
propstring-Form data key
placeholderstring-Input placeholder
variant`shortTextlongText`shortText
rowsnumber4Rows for longText variant
disabledbooleanfalseDisabled state
requiredbooleanfalseRequired field

Default Value (Flat Format)

In flat format, you can set an initial default value using value.default:

json
{
  "id": "nameField",
  "component": "TextField",
  "label": "Name",
  "value": { "path": "/form/name", "default": "John Doe" }
}
TextField with Default Value
无内容

Basic Example

Basic TextField
无内容

Long Text Example

Textarea Field
无内容

Required Field Example

Required Field
无内容

Form Example

Form with TextField
无内容

JSON Schema

json
{
  "id": "textFieldId",
  "type": "a2-text-field",
  "props": {
    "label": "Field Label",
    "prop": "fieldName",
    "placeholder": "Enter value...",
    "variant": "shortText",
    "required": false
  }
}

A2UI Documentation