Select family
Four fields for choosing from a list. They share one menu, keyboard model, and set of states; they differ in how people find options and how many they can choose.
Select
<tk-select aria-label="Department" placeholder="Select a department"> <option>Design</option> <option>Engineering</option> <option>Finance</option> </tk-select>
A button that opens a closed list. Typing a letter jumps to a match.
Combobox
<tk-combobox aria-label="City" placeholder="Start typing a city"> <option>Amsterdam</option> <option>Berlin</option> <option>Copenhagen</option> <option>Lisbon</option> </tk-combobox>
A text field that filters the list as people type. Options can come from markup, an
array, or your server. creatable lets people add their own value.
Multiselect
<tk-multiselect aria-label="Colors" placeholder="Choose colors"> <option selected>Red</option> <option>Green</option> <option selected>Blue</option> </tk-multiselect>
Chosen options show as chips. The menu stays open while people choose. It filters like a
Combobox with searchable, and max caps the choice.
Country select
<tk-country-select aria-label="Country" value="NL"></tk-country-select>
A Combobox with every country, localized names, and flags built in. The value is the two-letter code.
What they share
- Naming: put any of them in a
Field for a label, helper, and error, or setaria-label. - Sizes:
medium(32px) andlarge(36px), matching Input and Button. - States:
disabled(not focusable, not submitted) andreadonly(focusable and submitted, but can't change). - Menu: the same rows, check marks, and group headers, from
<option>and<optgroup>children. - Filter bars: Select and Multiselect have
variant="filter", a compact button withfilter-label.
<tk-select variant="filter" filter-label="Status"> <option>Open</option> <option>Closed</option> </tk-select> <tk-multiselect variant="filter" filter-label="Labels"> <option>Bug</option> <option>Feature</option> </tk-multiselect>
When to use
| People need to | Use |
|---|---|
| choose one from about 4 options up to a screenful | |
| choose one from a long list, by typing | |
| choose a country | |
| choose several | searchable for long lists |
| choose from 2 or 3 options, all visible | |
| run an action |
Related
Field : the label, helper, and error around any of these.Tag : the chip a Multiselect uses.Phone input : a phone number field with a compact Country select.Menu : items that run actions.