Autocomplete component is a parent component that adds autocomplete functionality to a
See Storybook for React guidance of this component.
|Unique identifier for this item|
|Displayed value of the item. May alternatively provide a |
|Custom React node as an alternative to a string-only |
|Additional classes to be added to the root element. Useful for adding utility classes.|
|Whether this item should be counted as one of the results for the purpose of announcing the result count to screen readers|
The following CSS variables can be overridden to customize Autocomplete components:
<Autocomplete> component also makes use of a text field, which can be customized by the following variables:
- If you are returning results from a known domain like a database of zip codes or a taxonomy of keywords
- If you have a list of options that would cause a dropdown to be unusually long
- When users are choosing from a specific set of options. Consider checkboxes, radio buttons, or a dropdown in these cases.
- Don't use placeholder text in autocomplete fields. Try to write a descriptive label that identifies what the user is searching for. People who have cognitive or visual disabilities have additional problems with placeholder text.
- The length of the text field provides a hint to users as to how much text to write. Do not ask users to write paragraphs of text in this component; use a
<Autocomplete>component has taken special care to ensure accessibility for screenreader devices. It announces the number of results based on
itemsmatches with the
inputValuestring. The component also reads out the name of each list item when users arrow up or down.
<Autocomplete>allows developers to add hint text in the
<label>element. This hint
<span>is added to the markup by passing a
<Autocomplete>has a button (styled visually as a link) to clear the search, and refocus the
<input>element. This resets the local state
null, and will re-read the label and screenreader hint text.
For more information about how we tested and validated our work for each checklist item, read our component maturity documentation.
ColorMeets AA color contrast standards for accessibility and color blindness.Complete
Forced Colors Mode (FCM)While using FCM the components text is legible and improves readability.Complete
WCAG 2.1 Level AA ConformanceAll Axe checks for WCAG AA compliance have passed.Complete
Screen readersVoiceOver, NVDA, and JAWS screen readers provide concise communication and interaction.Complete
Keyboard navigationComponent is fully navigable with a keyboard.Complete
StorybookComponent has stories to cover all defined props.Complete
ResponsiveComponent designed to work in all responsive breakpoints.Complete
Spanish translationsIncludes Spanish translations for default text content.Complete
CodeTokens implemented in code.Complete
DesignTokens implemented in the Sketch.Complete