Forms
MultiSelect
Choose several options from a grouped or flat list and submit them as repeated form values.
import { MultiSelect } from '@reactloom/ui';Examples
Workspace permissions
Workspace permissions
Choose all permissions this role needs.
import { MultiSelect } from '@reactloom/ui';
export default function Example() {
return <MultiSelect label="Workspace permissions" name="permission" defaultValue={['view']}
description="Choose all permissions this role needs."
options={[
{ value: 'view', label: 'View invoices' },
{ value: 'edit', label: 'Edit invoices' },
{ value: 'refund', label: 'Issue refunds', disabled: true },
]} />;
}Controlled shipping regions
Shipping regions
import { useState } from 'react';
import { MultiSelect } from '@reactloom/ui';
export default function Example() {
const [regions, setRegions] = useState<string[]>([]);
return <MultiSelect label="Shipping regions" value={regions} onValueChange={setRegions}
renderValue={(labels) => `${labels.length} selected: ${labels.join(', ')}`}
options={[
{ label: 'South Asia', options: [{ value: 'in', label: 'India' }, { value: 'lk', label: 'Sri Lanka' }] },
{ label: 'Europe', options: [{ value: 'de', label: 'Germany' }] },
]} />;
}API reference
| Prop | Type | Default |
|---|---|---|
optionsFlat choices or labeled groups. | SelectItems | — |
value · defaultValueSelected keys. | readonly string[] | — |
onValueChangeReceives selected keys. | (value: string[]) => void | — |
label · aria-labelProvide a visible label or an accessible name. | ReactNode · string | — |
name · requiredNative form name and validation. | string · boolean | — |
renderValueCustomize the trigger summary. | (labels: readonly string[]) => ReactNode | — |
Keyboard interaction
| Key | Action |
|---|---|
| Enter or Space | Open the list or toggle the focused option |
| Arrow keys | Move between options |
| Escape | Close and return to the trigger |
Usage guidelines
Do
- Use stable, unique option values. Prefer a short summary when many choices can be selected.
Don’t
- Avoid putting interactive controls inside option labels.