Skip to content
Harness Design System Harness Design System Harness Design System

MultiSelect

beta

The MultiSelect component allows users to select multiple options from a dropdown list. It is useful for scenarios where multiple selections are needed.

Usage

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

MultiSelectOption Type

interface MultiSelectOption {
id: string | number; // Required - the unique identifier for the option
key: string; // Required - the main identifier for the option
value?: string; // Optional - used for key-value pairs
disable?: boolean; // Optional - disables the option in the dropdown
onReset?: () => void; // Optional - custom reset handler for the option
}

API Reference

Prop
Required
Default
Type
labelfalsestring
captionfalsestring
valuefalseMultiSelectOption[]
defaultValuefalseMultiSelectOption[]
optionsfalseMultiSelectOption[]
placeholderfalsestring
searchQueryfalsestring | null
setSearchQueryfalse(query: string | null) => void
onChangefalse(options: MultiSelectOption[]) => void
maxSelectedfalsenumber
onMaxSelectedfalse(maxLimit: number) => void
disabledfalseboolean
classNamefalsestring
disallowCreationfalseboolean
isLoadingfalseboolean