A wrapper for an html <select> element with an optional <label> tag and helper text.
Snippet
Use this interactive snippet to try the component:
<divstyle={{width:200}}><FieldLabelhtmlFor="swarm-select">Swarm Select</FieldLabel><Selectvalue="A"id="swarm-select"name="swarm-select"onChange={(e)=>alert(e.target.value)}><optionvalue="A">
A
</option><optionvalue="B">
B
</option><optionvalue="C">
C
</option><optionvalue="D">
D
</option></Select></div>
Props
Name
Type
Required?
Default
Description
disabled
boolean
optional
none
Whether the select menu is disabled.
error
string
optional
none
Whether the select menu has errored.
id
string
optional
none
Unique identifier for select tag.
name
string
required
none
Name of select menu form field.
requiredText
string
optional
none
Copy to be used for a required select field.
a11y
The following keyboard interactions are used to control the select component.
You can also filter by typing letters, but this behavior varies by browser.
Some will filter as you type, like autocomplete. Others will only sort by first letter.
E.g., in a list of US States, hitting A then R may take you to Arizona, or it may
take you to Alabama and then Rhode Island.