- Implementation
- MultiSelectField Props
- MultiSelectFieldSync Props
- MultiSelectFieldOption Type
Overview
The multi-select field family includes two components for different use cases:MultiSelectField— For async data loading with support for pagination (page-based, offset-based, or group-based lazy loading)- Includes automatic debouncing of the search input (configurable via the
debounceMsprop) - Includes automatic caching of the search input (configurable via the
cacheprop)
- Includes automatic debouncing of the search input (configurable via the
MultiSelectFieldSync— For client-side filtering of static option arrays
MultiSelectFieldSync (Static Options)
UseMultiSelectFieldSync when you have a static list of options that can be filtered client-side.Filtering and Sorting
By default,MultiSelectFieldSync uses match-sorter to filter options by their label and searchText fields. Results are also ranked by match quality, so the best matches appear first. Before any search is performed, options appear in the order they are supplied.
You can customize this behavior in two ways:Using match-sorter options
Pass a match-sorter options object to customize the default filtering and sorting behavior (e.g., change which keys are matched or adjust ranking):Using a custom filter function
Pass a function for full control over both filtering and sort order. The returned array determines the exact order options appear in the dropdown:MultiSelectField (Async Loading)
UseMultiSelectField when options need to be fetched from an API or when dealing with large datasets that require server-side filtering.Basic Usage
Lazy Loading Modes
MultiSelectField supports three lazy loading modes for paginated data:Page-based Pagination
Offset-based Pagination
Group-based Loading
For loading grouped options incrementally:Select All
Enable bulk selection with theselectAll prop.Select All is shown only when the search input is empty.
MultiSelectField
WithMultiSelectField, the parent component is responsible for handling the select/deselect logic via onClick and managing the checkState:checkState also accepts a function of the current selection, which the field resolves for you. This keeps the checkbox in sync with the selection without recomputing it at the call site:MultiSelectFieldSync
MultiSelectFieldSync provides a simplified selectAll prop. Click handling and check state are managed automatically:Select Filtered
Enable selection of options matching the current search term with theselectFiltered prop. Select All and Select Filtered are mutually exclusive: Select All is shown when the search input is empty, and Select Filtered is shown when a search term is active. The default label dynamically includes the search term (e.g., Select items matching "appl").MultiSelectField
WithMultiSelectField, provide a function that receives the current searchValue and returns a config object with onClick, checkState, and an optional label. Since the function receives the search value, you can use it to filter options and compute the checked state inline:MultiSelectFieldSync
MultiSelectFieldSync provides a simplified selectFiltered prop. Click handling and check state are managed automatically based on the filtered options and current selection:Chip Display Options
Control how selected options are displayed as chips:Single Row Mode
Restrict the field to a single row height. Overflow chips are collapsed into a “+N” indicator:Max Chips
Limit the number of visible chips regardless of row height:Chip Customization
Customize the appearance of individual chips usinggetChipProps. The callback receives each selected option and returns partial ChipProps (e.g., color, icon, avatar). Core chip props (label, onClose, className, title, size) are managed by the component and excluded from the callback’s return type.Display Modes
Control how the options menu is displayed using thedisplayMenuAs prop:Caching
MultiSelectField caches loadOptions results by default. Configure caching behavior:Clearing the Cache
Use a ref to imperatively clear the cache:Invalidating Options
Callinvalidate() to clear the cache and reload options from the data source. Use this when the underlying data has changed and the component needs to reflect the update:MultiSelectFieldSync handles this automatically when its options prop changes.Initial Load Behavior
Control when options are first loaded with theinitialLoad prop:Field States
Error State
Display validation errors using theerror prop:Hint and Description
Provide additional context withhint and description:Required Field
Mark a field as required with therequired prop:Disabled and ReadOnly
Whendisabled is set, users cannot interact with the field:readOnly is set, users can see the dropdown but cannot change selections:Prefix and Suffix
Add content before or after the input withprefix and suffix:Markdown in labels
Thelabel prop supports inline markdown: bold (**text**), italic (*text*), bold and italic (***text***), highlight (==text==), and code (`text`).Hide the label
UsehideLabel to visually hide the label. The label string is converted to an aria-label on the input so it remains accessible to screen readers — any inline markdown is stripped to plain text.Sizes
Control the size of the field with thesize prop:Disabled Options
Individual options can be disabled by settingdisabled: true on the option:Pinned Options
Pin frequently used or suggested options above the list using thepinned prop. Each pinned section requires a label and an options value, which can be a static array or a dynamic loader function.Static Pinned Options
Pass an object withlabel and a static options array:Dynamic Pinned Options
Pass a function asoptions to compute pinned options based on the current search value. This is useful for AI-powered suggestions or context-aware recommendations:searchReactive: false to call the loader once and reuse the result across all search values:Multiple Pinned Sections
Pass an array of pinned section objects:Grouping Options
Options can be organized into visual groups by adding agroup property to each option. Groups appear as labeled sections in the dropdown.Basic Grouping
Add agroup property to options and provide a groupToString function to display group labels:Group Sorting
UsegroupSorter to control the order of groups. By default, groups appear in the order they are first encountered in the options array. This prop is available on MultiSelectFieldSync and non-lazy MultiSelectField:Virtualization
By default, all dropdown options render to the DOM at once. This works well for typical lists but degrades performance with very large option sets as the browser must lay out and paint thousands of elements. Passvirtualize to enable windowed rendering, which only renders the items currently visible in the scroll viewport plus a small overscan buffer.Consider enabling virtualize when the dropdown feels sluggish to open or keyboard navigation becomes laggy. These symptoms typically appear around 200–500 items depending on device performance and item complexity (e.g., items with descriptions are heavier). For smaller lists, the default rendering path is sufficient and avoids the overhead of virtual positioning.Virtualization works with all existing features including lazy loading, pinned options, grouping, select-all/select-filtered bulk actions, and keyboard navigation.Disabling Search
PassdisableSearch to replace the searchable text input with a non-editable select trigger. The field uses the listbox ARIA pattern instead of combobox, providing a simpler interaction when typing to filter adds no value.This is useful when the option list is short and well-known or you are integrating with an API that does not support search.When
disableSearch is enabled, selectFiltered has no effect since there is no search input to produce filtered results.Adding New Items
Provide anonAddNewItem handler to render an “Add new item” button below the option list. This affordance lets users create a value that does not exist yet — a new tag, label, or attribute — quickly from the field.The button sits in a footer region inside the menu. Clicking or activating it via keyboard closes the menu and invokes the onAddNewItem handler with the current search text.From here, it is your responsibility to launch a Dialog (or Drawer, or any other overlay) for collecting the new item’s details, append the result to the option source, invalidate the cache, and update selection state.You may pair onAddNewItem with addItemLabel to control the button text. The label accepts a static node or a function of the current search text — for example, returning Add "foo" when the user has typed foo.Call
invalidate() on the imperative handle after appending the new option.
This clears the cached search results and forces a refetch the next time the
menu opens, so the new item appears immediately. clearCache() alone wipes
the cache but keeps the previously displayed options on screen until
something else triggers a reload.