Multi Select
A field that opens a sheet of checkboxes and shows every option the user picks as a chip.
Installation
Tip
Usage
src/app/app.ts
- Tapping the field opens the sheet. Each item has a checkbox.
- Tapping an item toggles it. The sheet stays open.
- Done, the dimmed backdrop, or dragging the handle down closes the sheet.
valuelists the chosen values in the order they were chosen.- The field shows the chosen items' labels as chips, in that order. It grows onto more lines as they need. With none chosen, it shows
placeholder.
Search
Add searchable for a long list. It works as Select's search does:
- The sheet opens at full height, with a search field under its header.
- Typing hides the items whose
labeldoesn't contain the text. Case doesn't matter. emptyTextshows when nothing matches.- Set
[filter]="false"to show results of your own for[(query)].
Icons
Content in an item, such as an Icon, goes between its checkbox and its label:
Disabled
A disabled field dims and doesn't open.
Open from code
UiMultiSelect has public open(), close() and toggle() methods. Get it with viewChild(UiMultiSelect) and call them from a handler. open() and toggle() do nothing while disabled.
Accessibility
- The field is one button to VoiceOver and TalkBack, named by
label(oraccessibility-label). Its value is the chosen labels, or the placeholder: VoiceOver says "Topics, News, Sport, button". - The sheet's title is a heading, and Done is a button.
- Each item is a button named by its
label, andselectedwhile it's chosen.
So a spec finds them by role:
API
UiMultiSelect
UiMultiSelectItem
No outputs. Content inside the item, such as an icon, goes between its checkbox and its label.
