The Dropdown component is used to used to gather input from a user. It emits a <select>
tag to create a dropdown list. Best practice is to use this component as a child of FormGroup
.
Three sizes are supported: 'lg'
(default), 'md'
and 'sm'
. Use the size
property to set the size.
Use the disabled
property to disable a dropdown. A disabled element is unusable and un-clickable.
ReadOnly is not a supported state for the Dropdown component.
Property | Type | Default | Description |
---|---|---|---|
className | String | Any custom classes to add to the <select> element. | |
disabled | Boolean | false | Controls whether the component is enabled or disabled. |
id | String | Sets the id attribute on the <select> element. If used within a FormGroup , the controlId property will be used. This property overrides that. | |
listSize | Number | 1 | Number of visible <Dropdown.Option> items. If used with multiple , default will be 4 . |
multiple | Boolean | false | When true , multiple options can be selected at once. |
required | Boolean | false | Adds the required attribute to the <select> element. NOTE: This does not perform any validation, but rather just marks the field as required. |
size | String | 'lg' | Size of the <select> element. Options are 'lg' , 'md' , 'sm' . |
validationMessageState | String | If used in conjunction with field validation, this provides the icon next to the label. Options are 'error' , 'warning' . |
Property | Parameters | Description |
---|---|---|
onBlur | event | Callback function for onBlur events. |
onChange | event | Callback function fired when option is selected. |
onFocus | event | Callback function for onFocus events. |
Property | Type | Default | Description |
---|---|---|---|
children | String | Display text. | |
disabled | Boolean | false | Controls whether the component is enabled or disabled. |
selected | Boolean | false | When true , the option is pre-selected when the page loads. |
value | String | Controls the value. |