Examples

Workspace permissions

Preview
Workspace permissions

Choose all permissions this role needs.

Example.tsx
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

Preview
Shipping regions
Example.tsx
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

MultiSelect props
PropTypeDefault
options
Flat choices or labeled groups.
SelectItems—
value · defaultValue
Selected keys.
readonly string[]—
onValueChange
Receives selected keys.
(value: string[]) => void—
label · aria-label
Provide a visible label or an accessible name.
ReactNode · string—
name · required
Native form name and validation.
string · boolean—
renderValue
Customize the trigger summary.
(labels: readonly string[]) => ReactNode—

Keyboard interaction

Keyboard interactions
KeyAction
Enter or SpaceOpen the list or toggle the focused option
Arrow keysMove between options
EscapeClose 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.