---
title: Multi-Select Dropdown
product: Form Library
description: SurveyJS Multi Selection Tag Box lets your users select several values from a drop-down list at once. View a free demo for JavaScript to learn how to create a multiple-choice dropdown in minutes.
framework: React
source: https://surveyjs.io/form-library/examples/how-to-create-multiselect-tag-box/reactjs
index: https://surveyjs.io/form-library/examples/overview.md
---

# Multi-Select Dropdown (React)

Tag Box questions allow respondents to select multiple values from a drop-down list. Selected items are displayed in the input field as removable tags. This example shows how to add a multiple-selection dropdown with a search option to your survey.

## Create a Tag Box Question

To create a [Tag Box](https://surveyjs.io/form-library/documentation/questiontagboxmodel) question, define an object with the `type` property set to `"tagbox"` and add it to the [`elements`](https://surveyjs.io/form-library/documentation/pagemodel#elements) array. Use the [`choices`](https://surveyjs.io/form-library/documentation/questiontagboxmodel#choices) array to specify drop-down list items. This array can contain either of the following:

- String values
  
  ```js
  "choices": [ "Option 1", "Option 2", "Option 3" ] 
  ```

- Objects with the `text` (display value) and `value` (value to be saved in survey results) properties

  ```js
  "choices": [{
    "text": "Option 1", 
    "value": 1
  }, {
    "text": "Option 2",
    "value": 2
  }, {
    "text": "Option 3",
    "value": 3
  }] 
  ```

If you want to load choice values from a RESTful service as shown in this example, use the [`choicesByUrl`](https://surveyjs.io/form-library/documentation/questiontagboxmodel#choicesByUrl) property instead. It accepts an object that configures access to the web service. This demo specifies only the service's URL. Refer to the [ChoicesRestful](https://surveyjs.io/form-library/documentation/choicesrestful) object for more information on how to configure the `choicesByUrl` property.

## Configure Search

Respondents can search in the drop-down list to find the item they are looking for. Enter a text string right into the input field to try this functionality. If you want to disable search, assign `false` to the [`searchEnabled`](https://surveyjs.io/form-library/documentation/questiontagboxmodel#searchEnabled) property.

## Hide Selected Items

Selected items are added to the input field as tags. However, they also remain highlighted in the drop-down list. If you want selected items to be removed from the list, enable the [`hideSelectedItems`](https://surveyjs.io/form-library/documentation/questiontagboxmodel#hideSelectedItems) property. This example demonstrates the default behavior.

## Implement a Custom Item Template

If you want to customize drop-down list items, create and apply a custom item template. Since Tag Box shares this functionality with the Dropdown question, refer to the following Dropdown demo for detailed instructions: [Dropdown with Custom Item Template](https://surveyjs.io/form-library/examples/questiontype-dropdown-itemtemplate/).

## See Also

[Conditionally Display Choice Options](/form-library/examples/how-to-conditionally-display-choice-options/ (linkStyle))

## Files

### `public/index.html`

```html
<div id="surveyElement" style="position: absolute; top: 0; left: 0; right: 0; bottom: 0; min-height: 100%; height:100%"></div>
```

### `src/SurveyComponent.jsx`

```js
import React from "react";
import { Model } from "survey-core";
import { Survey } from "survey-react-ui";
import "survey-core/survey-core.min.css";
import "./index.css";
import { json } from "./json";

function SurveyComponent() {
    const survey = new Model(json);
    survey.onComplete.add((sender, options) => {
        console.log(JSON.stringify(sender.data, null, 3));
    });
    return (<Survey model={survey} />);
}

export default SurveyComponent;
```

### `src/index.css`

```css
/* You can add your custom CSS here. */
```

### `src/index.js`

```js
import React from "react";
import { createRoot } from "react-dom/client";
import SurveyComponent from "./SurveyComponent";

const root = createRoot(document.getElementById("surveyElement"));
root.render(<SurveyComponent />);
```

### `src/json.js`

```js
export const json = {
  "elements": [
    {
      "type": "tagbox",
      "isRequired": true,
      "choicesByUrl": {
        "url": "https://surveyjs.io/api/CountriesExample"
      },
      "name": "countries",
      "title": "Which countries have you visited within the last three years?",
      "description": "Please select all that apply."
    }
  ]
};
```

### `src/theme.js`

```js
export const themeJson = {};
```

### `package.json`

```json
{
  "dependencies": {
    "react": "latest",
    "react-dom": "latest",
    "survey-core": "latest",
    "survey-react-ui": "latest"
  },
  "devDependencies": {
    "react-scripts": "latest"
  }
}
```

## Other Frameworks

- [Angular](https://surveyjs.io/form-library/examples/how-to-create-multiselect-tag-box/angular.md)
- [Vue 3](https://surveyjs.io/form-library/examples/how-to-create-multiselect-tag-box/vue3js.md)
- [jQuery](https://surveyjs.io/form-library/examples/how-to-create-multiselect-tag-box/jquery.md)
- [Vanilla JS](https://surveyjs.io/form-library/examples/how-to-create-multiselect-tag-box/vanillajs.md)
