Homecomponentsinput

MultiSelect

A text field that allows searching from a large collection of options.

Alpha
This component is in development. There could be breaking changes made to it in a non-major release of Prism. Please use with caution.

Overview

Create a text input that aids in filtering and selecting multiple items from a list of options. It also supports most of the features of the TextField.

Here's an example of a simple MultiSelect.

Your Car Manufacturers

Empty State

Use emptyState property to show when there are no options available.

Your Car Manufacturers

Disabled

Use disabled property to prevent any interaction with the MultiSelect.

Your Car Manufacturers

Highlight search matches

Use highlightMatches property to highlight found matches in MultiSelect dropdown.

Your Car Manufacturers

API

onQueryChange
Required
Called when the query is changed.
(value: string) => void

value
Required
The selected option.
MultiSelectOption[]

onChange
Required
Called when a selection is made.
(value: MultiSelectOption[]) => void

options
Required
The options to display.
MultiSelectOption[]

emptyState
Required
The text or element to show when no matches found.
string

name
Required
Name for the field.
string

query
The query.
string

highlightMatches
Highlights the matches if true.
true
false

disabled
Disables the field.
true
false

label
Adds a label to the field.
string

id
ID of the field.
string

tip
Tooltip shown next to the label.
string

secondaryLabel
Adds a secondary label to the field.
ReactNode

description
Note shown below the field.
string

errorMessage
Displays an error message under the field.
string

textAlign
Aligns the text horizontally.
center
end
start

size
Size of the field.
small
regular

data
An object with the data keys and values.
DataAttributeMap

placeholder
Placeholder of the text field.
string

onBlur
Action to perform when the field is blurred.
FocusEventHandler<HTMLInputElement>

onKeyDown
Action to perform when a key is pressed.
KeyboardEventHandler<HTMLInputElement>

required
Indicates the field is required.
true
false

maxLength
Maximum character length for an field.
number

ref
Ref<HTMLInputElement>

key
Key | null