Skip to content

Multi Select

The MultiSelect component lets users select multiple options from a dropdown list. Selected options appear as removable tags, and users can optionally create new options by typing. It’s suited to scenarios where more than one value is needed — tags, frameworks, labels, and similar.

Variations

Disallow creation

The MultiSelect component accepts an optional disallowCreation prop. When set to true, it disables the ability to add new items that are not part of the existing options list.

Form integration

The MultiSelect component integrates seamlessly with form elements like labels, captions, and validation messages. A non-empty error sets the theme to danger; a non-empty warning sets it to warning.

With tooltip

tooltipContent is used to display the content of the tooltip. tooltipProps is used to pass additional props to the tooltip.

Orientation

The MultiSelect component accepts an optional orientation prop, which defines the layout direction of the input and its label. Available options are horizontal and vertical (default).

Installation

import { MultiSelect, MultiSelectOption } from "@harnessio/ui/components";
import { useState } from "react";
// Basic usage with controlled component
const MyComponent = () => {
const [selected, setSelected] = useState<MultiSelectOption[]>([]);
return (
<MultiSelect
label="Select frameworks"
placeholder="Select options..."
options={[
{ key: "react", id: "react" },
{ key: "vue", id: "vue" },
{ key: "angular", id: "angular" },
]}
value={selected}
onChange={setSelected}
/>
);
};