Skip to content

Function: multiSelect()

ts
function multiSelect(props: React.ComponentProps<typeof UiMultiSelectField>): Element;

Defined in: src/UI/blocks/multiSelect.tsx:65

Experimental

Multi-select field component for dropdown selection, supporting async and advanced props.

Parameters

ParameterTypeDescription
propsReact.ComponentProps<typeof UiMultiSelectField>Props for configuring the multi-select field.

Returns

Element

Examples

Simple usage with required props

tsx
multiSelect({
  name: 'country',
  label: 'Country',
  items: [
    { value: 'us', label: 'United States' },
    { value: 'uk', label: 'United Kingdom' },
    { value: 'ca', label: 'Canada' }
  ]
});

Usage with async items and validation

tsx
multiSelect({
  name: 'favoriteColor',
  label: 'Favorite Color',
  items: async ({ data, value }) => fetchColors(data, value),
  invalid: async ({ data, value }) => value.length === 0 ? 'Required' : false,
  required: true
});

With default selected values

tsx
multiSelect({
  name: 'languages',
  label: 'Languages',
  items: [
    { value: 'en', label: 'English' },
    { value: 'fr', label: 'French' },
    { value: 'es', label: 'Spanish' }
  ],
  defaultValues: ['en', 'fr']
});

Matterway Assistant SDK Documentation