---
title: Multi select
description: MultiSelect lets people pick several options from a dropdown and shows the choices as chips.
category: Forms
related: [Select, CheckboxMultiSelect, AutoComplete]
---

Source: https://clickhouse.design/click-ui/multiselect

# Multi select

MultiSelect is a dropdown for choosing several options. The selected options show as chips in the field. Use Select when only one option can be chosen.

## Example

## Props

| Prop              | Type                                     | Default value | Description                                                                   |
| ----------------- | ---------------------------------------- | ------------- | ----------------------------------------------------------------------------- |
| value             | `string[]`                               | `undefined`   | The selected values, for a controlled field                                   |
| defaultValue      | `string[]`                               | `undefined`   | The initially selected values, for an uncontrolled field                      |
| onSelect          | `(value: string[], type?, evt?) => void` | `undefined`   | Called with the new array of selected values                                  |
| options           | `SelectOptionListItem[]`                 | `undefined`   | The options, as an alternative to MultiSelect.Item children                   |
| children          | `ReactNode`                              | `undefined`   | MultiSelect.Item and MultiSelect.Group elements, as an alternative to options |
| label             | `ReactNode`                              | `undefined`   | Label shown with the field                                                    |
| placeholder       | `string`                                 | `undefined`   | Text shown when nothing is selected                                           |
| error             | `ReactNode`                              | `undefined`   | Pass true for the error style, or a message to show below the field           |
| disabled          | `boolean`                                | `undefined`   | Whether the field is disabled                                                 |
| sortable          | `boolean`                                | `undefined`   | Whether the selected chips can be reordered by dragging                       |
| showSearch        | `boolean`                                | `undefined`   | Whether to show a search input in the dropdown                                |
| allowCreateOption | `boolean`                                | `undefined`   | Whether people can add an option that is not in the list                      |
| maxHeight         | `string`                                 | `undefined`   | Maximum height of the dropdown                                                |
| orientation       | `"vertical" \| "horizontal"`             | `undefined`   | Whether the label sits above or beside the field                              |
| dir               | `"start" \| "end"`                       | `undefined`   | Which side of the field the label sits on                                     |
| defaultOpen       | `boolean`                                | `undefined`   | Whether the dropdown starts open                                              |
| onOpenChange      | `(open: boolean) => void`                | `undefined`   | Called when the dropdown opens or closes                                      |
| name              | `string`                                 | `undefined`   | Name submitted with a form                                                    |
| form              | `string`                                 | `undefined`   | ID of the form the field belongs to                                           |
| container         | `HTMLElement`                            | `undefined`   | Element the dropdown is portalled into                                        |

```tsx
import { MultiSelect } from '@clickhouse/click-ui'
import { useState } from 'react'

function TagsSelect() {
  const [values, setValues] = useState<string[]>([])

  return (
    <MultiSelect
      label="Tags"
      value={values}
      onSelect={setValues}
      options={[
        { label: 'React', value: 'react' },
        { label: 'TypeScript', value: 'typescript' },
      ]}
    />
  )
}
```

### MultiSelect.Item props

| Prop        | Type                   | Default value | Description                                  |
| ----------- | ---------------------- | ------------- | -------------------------------------------- |
| value \*    | `string`               | `required`    | The value of the option                      |
| label \*    | `ReactNode`            | `required`    | The text of the option                       |
| description | `ReactNode`            | `undefined`   | Secondary text shown with the option         |
| icon        | `IconName \| LogoName` | `undefined`   | Icon shown with the option                   |
| iconDir     | `"start" \| "end"`     | `undefined`   | Which side of the label the icon sits on     |
| disabled    | `boolean`              | `undefined`   | Whether the option can be chosen             |
| separator   | `boolean`              | `undefined`   | Whether to draw a separator after the option |

`MultiSelect.Group` takes a required `heading` and wraps the items in that group.

## Quick start

```tsx
import { MultiSelect } from '@clickhouse/click-ui'
import { useState } from 'react'

function Regions() {
  const [regions, setRegions] = useState<string[]>([])

  return (
    <MultiSelect label='Regions' value={regions} onSelect={setRegions}>
      <MultiSelect.Group heading='Europe'>
        <MultiSelect.Item value='eu-west' label='EU West' />
        <MultiSelect.Item value='eu-central' label='EU Central' />
      </MultiSelect.Group>
      <MultiSelect.Group heading='Americas'>
        <MultiSelect.Item value='us-east' label='US East' />
      </MultiSelect.Group>
    </MultiSelect>
  )
}
```

## Related components

- **Select**: For choosing a single option.
- **CheckboxMultiSelect**: For a dropdown of checkboxes instead of chips.
- **AutoComplete**: For a text input that suggests options.

## Common use cases

### Grouped options

### Error state
