Skip to main content

An official website of the United States government

Here's how you know

An official website of the United States government

Here's how you know


Design system switcher


Design system switcher


Design system switcher


Design system switcher


Autocompletes allow users to enter any combination of letters, numbers, or symbols of their choosing (unless otherwise restricted), and receive one or more suggested matches in a list below the input.


The Autocomplete component is a parent component that adds autocomplete functionality to a TextField component.




See Storybook for React guidance of this component.

Autocomplete items

An <Autocomplete> component accepts a list of items (JavaScript objects) that conform to the shape described by the table below.

idstringUnique identifier for this item
namestringDisplayed value of the item. May alternatively provide a children value
childrenReact.ReactNodeCustom React node as an alternative to a string-only name
classNamestringAdditional classes to be added to the root element. Useful for adding utility classes.
isResultbooleanWhether this item should be counted as one of the results for the purpose of announcing the result count to screen readers

Style customization

The following CSS variables can be overridden to customize Autocomplete components:

CSS variables for text-input
VariableDefault Core Theme Value
--text-input__background-color--disabledhex value: #d9d9d9--color-border
--text-input__border-colorhex value: #262626--color-base
--text-input__border-color--disabledhex value: #a6a6a6--color-gray-light
--text-input__border-color--errorhex value: #e31c3d--color-error
--text-input__border-color--error--inversehex value: #f7bbc5--color-error-lighter
--text-input__border-color--inversehex value: #000000--color-black
--text-input__colorhex value: #262626--color-base
--text-input__divider-colorhex value: #a6a6a6--color-gray-light


When to use

  • 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 to consider alternatives


  • 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 textarea instead.

View the "Forms" guidelines for additional guidance and best practices.


  • The <Autocomplete> component has taken special care to ensure accessibility for screenreader devices. It announces the number of results based on items matches with the inputValue string. 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 String into the hint prop.
  • <Autocomplete> has a button (styled visually as a link) to clear the search, and refocus the <input> element. This resets the local state selectedItem to null, and will re-read the label and screenreader hint text.

Component maturity

For more information about how we tested and validated our work for each checklist item, read our component maturity documentation.


  • Color

    Meets AA color contrast standards for accessibility and color blindness.
  • Forced Colors Mode (FCM)

    While using FCM the components text is legible and improves readability.
  • WCAG 2.1 Level AA Conformance

    All Axe checks for WCAG AA compliance have passed.
  • Screen readers

    VoiceOver, NVDA, and JAWS screen readers provide concise communication and interaction.
  • Keyboard navigation

    Component is fully navigable with a keyboard.


  • Storybook

    Component has stories to cover all defined props.
  • Responsive

    Component designed to work in all responsive breakpoints.
  • Spanish translations

    Includes Spanish translations for default text content.


  • Code

    Tokens implemented in code.
  • Design

    Tokens implemented in the Sketch.