Multiselect
A powerful multiselect component for choosing multiple options with search, selection limits, and bulk operations.
Basic Usage
Basic Multiselect
import { Multiselect } from 'fluxo-ui';
function MyComponent() {
const [values, setValues] = useState(['react', 'typescript']);
const options = [
{ label: 'React', value: 'react' },
{ label: 'Vue.js', value: 'vue' },
{ label: 'Angular', value: 'angular' },
{ label: 'TypeScript', value: 'typescript' },
// ... more options
];
return (
<Multiselect
label="Technologies"
placeholder="Select technologies..."
options={options}
value={values}
onChange={setValues}
/>
);
}Selection Limit
Maximum 3 Selections
<Multiselect
label="Favorite Colors (Max 3)"
placeholder="Choose up to 3 colors..."
options={colorOptions}
value={values}
onChange={setValues}
maxSelections={3}
/>Select All Option
Multiselect with Select All
<Multiselect
label="Skills"
placeholder="Select your skills..."
options={skillOptions}
value={values}
onChange={setValues}
showSelectAll
/>Grouped Options
Multiselect with Grouped Items
const groupedOptions = [
{
label: 'Frontend',
items: [
{ label: 'React', value: 'react' },
{ label: 'Vue.js', value: 'vue' },
{ label: 'Angular', value: 'angular' },
{ label: 'Svelte', value: 'svelte' },
],
},
{
label: 'Backend',
items: [
{ label: 'Node.js', value: 'nodejs' },
{ label: 'Django', value: 'django' },
{ label: 'Spring Boot', value: 'spring' },
{ label: 'Laravel', value: 'laravel' },
],
},
{
label: 'Mobile',
items: [
{ label: 'React Native', value: 'react-native' },
{ label: 'Flutter', value: 'flutter' },
{ label: 'Swift', value: 'swift', disabled: true },
],
},
];
<Multiselect
label="Technologies"
placeholder="Select technologies..."
options={groupedOptions}
value={values}
onChange={setValues}
showSelectAll={false}
/>Custom Field Mapping
Multiselect with optionLabel / optionValue
const countries = [
{ name: 'United States', code: 'US' },
{ name: 'Canada', code: 'CA' },
{ name: 'United Kingdom', code: 'UK' },
{ name: 'Germany', code: 'DE' },
];
<Multiselect
label="Countries"
placeholder="Select countries..."
options={countries}
optionLabel="name"
optionValue="code"
value={values}
onChange={setValues}
/>Without Search
Non-searchable Multiselect
<Multiselect
label="Options"
placeholder="Select options..."
options={options}
searchable={false}
/>States
Multiselect States
Please select at least one option
<Multiselect label="Normal" placeholder="Normal state" options={options} />
<Multiselect label="With Selections" options={options} value={['red', 'blue']} onChange={setValues} />
<Multiselect label="Disabled" placeholder="Disabled state" options={options} disabled />
<Multiselect label="Read Only" options={options} value={['green', 'yellow']} readonly />
<Multiselect label="Required" placeholder="Required field" options={options} required />
<Multiselect label="With Error" options={options} error="Please select at least one option" />Import
import { Multiselect } from 'fluxo-ui';Props
valueany[]Array of currently selected values (controlled component)
valueany[]Array of currently selected values (controlled component)
optionsreqListItem[] | ListItemGroup[]Flat array of items or grouped items. Each group has a label, optional icon, and an items array.
optionsreqListItem[] | ListItemGroup[]Flat array of items or grouped items. Each group has a label, optional icon, and an items array.
onChangefunctionChange event handler called with {event, value, name, args}
onChangefunctionChange event handler called with {event, value, name, args}
onFilterfunctionCalled when filter value changes: (query: string) => void | Promise<void>
onFilterfunctionCalled when filter value changes: (query: string) => void | Promise<void>
placeholderstringPlaceholder text when no options are selected
placeholderstringPlaceholder text when no options are selected
labelstringLabel text for the multiselect
labelstringLabel text for the multiselect
errorstringError message to display
errorstringError message to display
disabledbooleanfalseDisable the multiselect
disabledbooleanfalseDisable the multiselect
readonlybooleanfalseMake the multiselect read-only
readonlybooleanfalseMake the multiselect read-only
requiredbooleanfalseMark the multiselect as required
requiredbooleanfalseMark the multiselect as required
searchablebooleantrueEnable search/filter functionality
searchablebooleantrueEnable search/filter functionality
debounceMsnumber300Debounce delay in milliseconds for filter input
debounceMsnumber300Debounce delay in milliseconds for filter input
maxSelectedItemsnumberMaximum number of selections allowed
maxSelectedItemsnumberMaximum number of selections allowed
loadingbooleanfalseShow loading state
loadingbooleanfalseShow loading state
emptyMessagestring"No items available"Message to display when no options are available
emptyMessagestring"No items available"Message to display when no options are available
showSelectAllbooleantrueShow select all / deselect all option
showSelectAllbooleantrueShow select all / deselect all option
renderItemfunctionCustom render function for items: (item, index, isSelected, isHighlighted) => ReactNode
renderItemfunctionCustom render function for items: (item, index, isSelected, isHighlighted) => ReactNode
renderSelectedItemfunctionCustom render function for selected items: (item, onRemove) => ReactNode
renderSelectedItemfunctionCustom render function for selected items: (item, onRemove) => ReactNode
idstringHTML id attribute for the input element
idstringHTML id attribute for the input element
namestringHTML name attribute for form submission
namestringHTML name attribute for form submission
argsanyCustom arguments passed to onChange event
argsanyCustom arguments passed to onChange event
optionLabelstring"label"Property name to use as the display label from each option object
optionLabelstring"label"Property name to use as the display label from each option object
optionValuestring"value"Property name to use as the value from each option object
optionValuestring"value"Property name to use as the value from each option object
classNamestringAdditional CSS classes
classNamestringAdditional CSS classes
Features
Multi-Selection
Select multiple values at once with tag-style display of selected items
Built-in Search
Debounced filter input to quickly find options within large lists
Grouped Options
Organize options into labeled groups for better navigation
Selection Limit
Enforce a maximum number of selections with the maxSelectedItems prop
Select All
One-click bulk select and deselect all visible options
Custom Field Mapping
Use optionLabel and optionValue to work with any data shape
Async Filtering
onFilter callback supports async data loading with built-in debounce
Accessibility
Keyboard navigation, ARIA roles, and focus management built in
Theming
Full dark/light and 5 brand themes supported via CSS variables