Multiselect
The multiselect field allows the user to select multiple values from a predefined list of options.
Multiselect options must implement ListDisplayable to provide a displayable value.
Validation
The stringRepresenation received by any validators will be the current values separated by itemDelimiter
The value will be emptyList if no value is currently selected, or the list of ListDisplayable currently selected otherwise.
If the user enters a value that does not match a valid option, an error will be displayed
using invalidOptionError.
Common Validators
NotEmptyValidator
MinCountValidator
MaxCountValidator
Default usage
Along with common fields, the default multiselect field includes multiple styling and behavior options:
| Field | Type | Default | Description | Notes |
|---|---|---|---|---|
| itemDelimiter | String | ", " | The delimiter to use to separate items in store form and in the text field | Display names must not contain the delimiter |
| textFieldModifier | Modifier | Modifier.fillMaxWidth() |
Modifier applied to the text field inside the dropdown | |
| exposedDropdownBoxModifier | Modifier | Modifier |
Modifier applied to the overall exposed dropdown box | |
| exposedDropdownMenuModifier | Modifier | Modifier |
Modifier applied to the dropdown menu | |
| hint | Any? | null |
Hint displayed continuously in the text field | Converted using asDisplayString |
| placeholder | Any? | null |
Placeholder text shown when no value is selected | Converted using asDisplayString |
| isLast | Boolean | false |
Whether this field is the last field in the form | Controls IME action |
| leadingIcon | (@Composable () -> Unit)? | null |
Icon displayed at the start of the text field | |
| clearIcon | (@Composable () -> Unit)? | Close Icon | Icon allowing the user to fully clear the text field | |
| expandIcon | (@Composable () -> Unit)? | Caret arrow | Icon allowing the user to expand or collapse the dropdown menu | |
| menuItem | (@Composable (ListDisplayable) -> Unit)? | DefaultDropdownMenuItem |
Composable used to render each menu item | Requires ListDisplayable |