Responsive Combobox Components

Easy to use and customizable combobox components with mobile drawer and multi-select functionality.

Basic Examples

Single Select

Multi-Select

Responsive Design

Toggle between desktop (Popover) and mobile (Drawer) views to see the responsive behavior.

Single Select - Mobile Drawer

Multi-Select - Mobile Drawer

Loading State

Single Select with Loading

Multi-Select with Loading

Readonly State

Readonly Single Select

This combobox is disabled and shows a pre-selected value

Readonly Multi-Select

This multi-select is disabled and shows pre-selected values
API Documentation

Combobox API

Props

PropTypeDefaultDescription
itemsComboboxItem[]-Array of items to display in the combobox
onChange(value: string) => void-Callback when selection changes
noItemsLabelstring-Text to show when no items are available
placeholderstring-Placeholder text for the input
initialValuestring-Initial selected value
readonlybooleanfalseWhether the combobox is readonly
shouldFilterbooleantrueWhether to filter items based on search
onSearch(search: string) => void-Callback when search input changes
loadingbooleanfalseWhether to show loading state
classNamestring-Additional CSS classes

ComboboxItem Type

type ComboboxItem = {
  label: string;      // Display text
  value: string;      // Unique value
  suffix?: string;    // Optional suffix text
};

Example Usage

import Combobox from "@/components/combobox";

const items = [
  { label: "Apple", value: "apple" },
  { label: "Banana", value: "banana" },
  { label: "Cherry", value: "cherry" },
];

function MyComponent() {
  const [value, setValue] = useState("");

  return (
    <Combobox
      items={items}
      onChange={setValue}
      placeholder="Select a fruit"
      noItemsLabel="No fruits found"
      onSearch={(search) => console.log("Searching:", search)}
    />
  );
}

ComboboxMultiSelect API

Props

PropTypeDefaultDescription
itemsComboboxItem[]-Array of items to display in the combobox
onChange(value: string[]) => void-Callback when selection changes
noItemsLabelstring-Text to show when no items are available
placeholderstring-Placeholder text for the input
initialValuestring[]-Initial selected values
readonlyboolean-Whether the combobox is readonly
shouldFilterboolean-Whether to filter items based on search
onSearch(search: string) => void-Callback when search input changes
searchPlaceholderstringSearch optionsPlaceholder for search input
initialSearchstring-Initial search value
isLoadingboolean-Whether to show loading state
classNamestring-Additional CSS classes

Example Usage

import { ComboboxMultiSelect } from "@/components/combobox-multiselect";

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

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

  return (
    <ComboboxMultiSelect
      items={items}
      onChange={setValues}
      placeholder="Select frameworks"
      noItemsLabel="No frameworks found"
      searchPlaceholder="Search frameworks..."
      onSearch={(search) => console.log("Searching:", search)}
    />
  );
}