Configuration object
Name of the component
If false/undefined the field is valid. If a string is provided, it will be used as the validation message
If true, the field is disabled
Array of options for the select field
Label text
Placeholder text
If true, the field is required
Default selected value (must be one of the values in items)
Simple usage with required props
select({
name: 'country',
label: 'Country',
items: [
{ value: 'us', label: 'United States' },
{ value: 'uk', label: 'United Kingdom' },
{ value: 'ca', label: 'Canada' }
]
});
Usage with default value
select({
name: 'favoriteColor',
label: 'Favorite Color',
placeholder: 'Select your favorite color',
items: [
{ value: 'red', label: 'Red' },
{ value: 'blue', label: 'Blue' },
{ value: 'green', label: 'Green' }
],
defaultValue: 'blue',
required: true,
disabled: false
});
Select field component for dropdown selection.