Skip to content

MultiSelect

A tag-based select input supporting search, tag removals, clear actions, and dropdown selections.


Try Now


Usage

tsx
import React from "react";
import { MultiSelect } from "@lablnet/ui";

const techOptions = [
  { label: "React", value: "react" },
  { label: "Vue", value: "vue" },
  { label: "Angular", value: "angular" }
];

export default function MultiSelectDemo() {
  const [selected, setSelected] = React.useState<string[]>(["react"]);

  return (
    <div className="w-80">
      <MultiSelect 
        options={techOptions} 
        value={selected} 
        onChange={setSelected} 
        placeholder="Select framework..." 
      />
    </div>
  );
}

Customization

Props

PropTypeDefaultDescription
optionsMultiSelectOption[]-Array of available options: { label: string, value: string }
valuestring[]-Array of active selected values
onChange(value: string[]) => void-Triggers selection adjustments
placeholderstring"Select options..."Input placeholder if selection is empty
disabledbooleanfalseSets component disabled state

CSS Variables

Tag badges and list highlights align with:

css
:root {
  --secondary: 142.1 76.2% 36.3%;          /* Selected tag background HSL */
  --secondary-foreground: 355.7 100% 97.3%; /* Tag text color HSL */
  --accent: 220 14.3% 95.9%;                /* Dropdown hover item HSL */
}