Forms
MultiSelect
Pick several options with checkboxes; the trigger sums up the picks. Search, Select all and Clear included.
Ant Design: Select mode="multiple"
import { MultiSelect } from '@alea/ui';
Examples
Pick several
The trigger sums up the picks; search appears with many options.
Topics
2 picked
Without actions
A short list without Select all, and a disabled one.
Plans
Regions
Props
MultiSelect props
Pick several options from a list with checkboxes; the trigger summarizes the picks (Ant Select mode="multiple", Mantine MultiSelect).
| Prop | Type | Default | Description |
|---|---|---|---|
itemsrequired | { id: Key; label: string; description?: string | undefined; }[] | - | The options: id, label, optional description. |
defaultValue | Key[] | - | The selected ids to start with. |
description | ReactNode | - | Help text shown under the field. |
isDisabled | boolean | - | Disables every part of it. |
label | ReactNode | - | The visible label. |
onChange | ((keys: Key[]) => void) | - | Called with the selected ids. |
placeholder | string | 'Select…' | Shown while there is no value. |
searchable | boolean | - | Adds a search field to the list. Default true when there are more than 8 items. |
showActions | boolean | true | Adds "Select all" and "Clear". Default true. |
value | Key[] | - | The selected ids (controlled). |
Accessibility
- The trigger reads the label and the current picks.
- The list is a listbox with aria-multiselectable.
Keyboard
| Key | Does |
|---|---|
| Enter or Space | Opens |
| Arrow keys | Move |
| Space | Toggles an option |
| Escape | Closes |
Do and don't
Do
- Show how many are picked in the trigger.
- Add Select all and Clear for long lists.
Don't
- Don't use it for two or three options: use checkboxes.
- Don't hide the picks: summarize them in the trigger.