Select

Accessibility

NameTypeDescription
ariaLabelstringAllows you to specify an aria-label attribute of the component.
ariaLabelledbystringAllows you to specify an aria-labelledby attribute of the component.
ariaDescribedbystringAllows you to specify an aria-describedby attribute of the component.

Examples

<Select options={options} value={categoryValue} onChange={onChange} label="Category" />
<Select
options={options}
value={categoryValue}
onChange={onChange}
ariaLabel="Select passenger category"
/>
<Stack>
<p id="passengers-category-label" style={{ display: "none", visibility: "hidden" }}>
Select passenger category
</p>
<Select
options={options}
value={categoryValue}
onChange={onChange}
ariaLabelledby="passengers-category-label"
/>
</Stack>
<Select
options={options}
value={languageValue}
onChange={onChange}
label="Language"
ariaLabel="Select your language"
/>
<Select
options={countryOptions}
value={countryValue}
onChange={onChange}
label="Country"
ariaDescribedby="country-info"
/>
<p id="country-info" style={{ display: "none", visibility: "hidden" }}>
Select the country where you currently reside.
</p>
<Select
options={options}
value={nationalityValue}
onChange={onChange}
label="Nationality"
error="Required field"
/>
<p id="terms-info" style={{ display: "none", visibility: "hidden" }}>
Please review our terms and conditions.
</p>
<Select
options={termsOptions}
value={termsValue}
onChange={onChange}
label="Accept Terms"
error="This field is required"
ariaDescribedby="terms-info"
/>

InputGroup Integration

Example 1

<InputGroup label="Travel preferences" error="Please complete all fields">
<Select options={countryOptions} label="Departure country" />
<Select options={countryOptions} label="Destination country" />
</InputGroup>

Example 2

<InputGroup label="Travel preferences">
<Select options={countryOptions} label="Departure country" />
<Select options={countryOptions} label="Destination country" error="This field is required" />
</InputGroup>

Example 3

<InputGroup label="Contact information">
<Select
options={countryOptions}
label="Country"
ariaDescribedby="country-hint" // This will be overwritten
/>
<InputField label="Phone number" />
<p id="country-hint" style={{ display: "none", visibility: "hidden" }}>
Select the country prefix of your phone number
</p>
</InputGroup>