Skip to content

A2SelectField

Select dropdown field with options.

Props

PropertyTypeDefaultDescription
labelstring-Field label
propstring-Form data key
placeholderstring-Placeholder text
optionsarray[]Select options
clearablebooleanfalseClear button
disabledbooleanfalseDisabled state

Option Structure

typescript
interface SelectOption {
  label: string
  value: string | number
  disabled?: boolean
}

Default Value (Flat Format)

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

json
{
  "id": "genderField",
  "component": "SelectField",
  "label": "Gender",
  "options": [
    { "label": "Male", "value": "male" },
    { "label": "Female", "value": "female" }
  ],
  "value": { "path": "/form/gender", "default": "male" }
}
SelectField with Default Value
无内容

Basic Example

Basic Select
无内容

Clearable Example

Clearable Select
无内容

JSON Schema

json
{
  "id": "selectId",
  "type": "a2-select-field",
  "props": {
    "label": "Select Label",
    "prop": "fieldName",
    "placeholder": "Select option",
    "options": [
      { "label": "Option 1", "value": "opt1" },
      { "label": "Option 2", "value": "opt2" }
    ],
    "clearable": false
  }
}

A2UI Documentation