Combobox
A combobox looks like a field and opens a list you can search. Use it for a country, a person, a time zone, or any list too long to read at a glance.
When to use it
Use a combobox for a long list that people search by name, such as countries, people or time zones, or when an option needs a flag, a photo or a second line to be told apart. For a short list of plain options, a select is quicker.
A combobox chooses from its list. It does not accept a value that is not there.
Anatomy
The field shows the chosen option with its mark, and the chevron turns over while the list is open. The list opens 8px under the field, at the field's width.
- Bosnia and Herzegovina
- India
- Nepal
- Philippines
- Field
- the text field's fill, 44 px, 36 px in a toolbar with a mouse
- Field focus
- a 2 px outline, 2 px outside the field
- --brand-blue
- Flag, photo or icon
- 20 px, 24 px or 16 px
- Gap to the list
- 8 px
- List corner radius
- 12 px
- --radius-xl
- List padding
- 4 px
- --space-1
- List shadow
- the raised shadow
- --glass-shadow-raised
- Search row
- a 16 px icon and bare text, 36 px high
- Row
- 36 px, 44 px on touch, 10 px text inset
- Row under the pointer or the arrow keys
- a light fill
- --glass-fill-hover
- Check on the chosen row
- 16 px
- --brand-blue
Several choices
When a question takes several answers, such as the countries a recruiter covers, each row has a checkbox and the list stays open while you choose. The field lists the choices by name. When the names do not fit, the field ends with a count, such as “and 1 more”.
- Bosnia and Herzegovina
- Bulgaria
- Croatia
- Czechia
- India
- Nepal
- North Macedonia
- Philippines
- Serbia
- Slovakia
- Sri Lanka
- Uzbekistan
Search in the list
A list of more than 7 options opens with a search row, and typing narrows it. A shorter list has no search row. There, typing a letter jumps to the first option that starts with it.
When nothing matches, the list says so and repeats what was typed: No match for Kenya. A list that loads from the server shows grey placeholder rows until the options arrive.
- Bosnia and Herzegovina
No match for Kenya
Where the list opens
The list opens below the field. It opens upward when the room below is short and there is more above, and it scrolls inside itself so it stays in the window.
- Opens upward when the room below is under
- 280 px
- Tallest list
- 70 percent of the window
- Shortest list
- 176 px
- Distance from the window edge
- 8 px
Keyboard
Focus stays in the search row while the arrow keys move a highlight through the list, so typing and choosing do not get in each other's way. The pointer and the arrow keys light a row with the same fill.
- Enter, Space or Down arrow
- Opens the list
- Typing
- Narrows the list, or jumps to a letter
- Up and Down arrows
- Move the highlight
- Home and End
- First and last option
- Enter
- Chooses and closes, or ticks a row when several are allowed
- Escape
- Closes, and focus returns to the field
- Tab
- Closes and keeps the choice as it was
Long names
Options wrap onto a second line, so Democratic Republic of the Congo reads in full. The field shows the chosen name on one line and ends it with an ellipsis. A screen reader still hears the whole name.
- Croatia
- Czechia
- Democratic Republic of the Congo
- Denmark
- Dominican Republic
- Egypt
Accessibility
The field announces its label, the chosen option and that it opens a list. Options are not tab stops.
Escape closes only the list, even inside a dialog. The dialog stays open, and focus goes back to the field.