Skip to content

Combobox

Stable

A search box with suggestions that is never a closed list: whatever is typed can be used.

Also known as autocomplete, typeahead, searchable select, auto complete

Install with npm install @tattva/ui (setup), or copy the code from the kit in Downloads.

Company search with popular names

Focus the empty box to see the popular names and the hint. Type ama and press Enter to pick Amazon.

When to use it

Help people name something quickly, such as a company or a bank, without forcing them to choose from a list that may not contain it.

Made of: Search icon · Input · Popular names or matches · Use typed text row · Empty hint

Use it for

  • Asking which company, bank or shop, where the list can never be complete.
  • A name field where common answers are one tap and any other answer is still welcome.
  • Search where the text itself is the answer, not an id.

Not for

  • A fixed set where only the listed values are valid: use Select.
  • Running commands or jumping around the product: use CommandPalette.
  • A plain text answer with no suggestions: use TextField.
  • A list of actions opened from a button: use Menu.

Do and avoid

Do. Suggestions help, and people can still type a new seller.

Avoid. Typing lets people enter a value the list does not allow.

Do

  • Show popular names for the answers most people give.
  • Keep the last row that accepts the typed text, so the list never blocks anyone.
  • Use the text as the answer. Do not turn it into an id the person cannot see.
  • Say what the last row does in the words of your product with useTypedLabel.

Avoid

  • Do not use it when only the listed values are allowed. Use a Select.
  • Do not show more than a handful of matches. The list stops at 6.
  • Do not clear the box when the typed text is not in the list.
  • Do not use it to run commands. A command palette has a different job.

On a phone

  • The field is 16px on a touch screen, so the page does not zoom when it takes focus.
  • The suggestion list opens under the field, shows at most six rows, and each row is 44px tall.
  • The list always opens below the field, so near the bottom of a phone the on-screen keyboard can cover it; scroll the field up first.
  • Tapping a suggestion does not take focus from the field.

Build your next AI screen with Tattva.

Free and open, with the code. Start in one line.

Get started