A2SelectField
Select dropdown field with options.
Props
| Property | Type | Default | Description |
|---|---|---|---|
label | string | - | Field label |
prop | string | - | Form data key |
placeholder | string | - | Placeholder text |
options | array | [] | Select options |
clearable | boolean | false | Clear button |
disabled | boolean | false | Disabled 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" }
}Basic Example
Clearable Example
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
}
}