Propel

Combobox Field

A labeled combobox input with a filtered popup of selectable items and helper or error text.

Basic

Filter the deployment region.

Show code
import { ComboboxField } from "@makeplane/propel/components/combobox-field";
import { Icon } from "@makeplane/propel/components/icon";
import { IconButton } from "@makeplane/propel/components/icon-button";
import { ChevronsUpDown, X } from "lucide-react";

const REGIONS = ["us-central-1", "us-east-1", "eu-central-1", "ap-west-1"];

export default function BasicDemo() {
  return (
    <ComboboxField
      name="region"
      label="Region"
      description="Filter the deployment region."
      magnitude="md"
      items={REGIONS}
      placeholder="e.g. eu-central-1"
      empty="No regions found"
      clear={
        <IconButton
          prominence="ghost"
          tone="neutral"
          magnitude="md"
          aria-label="Clear region"
          icon={<Icon icon={X} />}
        />
      }
      trigger={
        <IconButton
          prominence="ghost"
          tone="neutral"
          magnitude="md"
          aria-label="Open region"
          icon={<Icon icon={ChevronsUpDown} />}
        />
      }
    />
  );
}

Magnitudes

Magnitude steps the label, description, and helper-text sizes; the input group itself stays fixed.

Filter the deployment region.

Filter the deployment region.

Filter the deployment region.

Show code
import { ComboboxField } from "@makeplane/propel/components/combobox-field";
import { Icon } from "@makeplane/propel/components/icon";
import { IconButton } from "@makeplane/propel/components/icon-button";
import { ChevronsUpDown, X } from "lucide-react";

const REGIONS = ["us-central-1", "us-east-1", "eu-central-1", "ap-west-1"];
const MAGNITUDES = ["md", "lg", "xl"] as const;

export default function MagnitudesDemo() {
  return (
    <div className="flex flex-col gap-4">
      {MAGNITUDES.map((magnitude) => (
        <ComboboxField
          key={magnitude}
          name={`region-${magnitude}`}
          label={magnitude}
          description="Filter the deployment region."
          magnitude={magnitude}
          items={REGIONS}
          placeholder="e.g. eu-central-1"
          empty="No regions found"
          clear={
            <IconButton
              prominence="ghost"
              tone="neutral"
              magnitude="md"
              aria-label="Clear region"
              icon={<Icon icon={X} />}
            />
          }
          trigger={
            <IconButton
              prominence="ghost"
              tone="neutral"
              magnitude="md"
              aria-label="Open region"
              icon={<Icon icon={ChevronsUpDown} />}
            />
          }
        />
      ))}
    </div>
  );
}

Invalid

Setting error marks the field invalid, recoloring the input group border and replacing the description with the error text.

Choose a deployment region.
Show code
import { ComboboxField } from "@makeplane/propel/components/combobox-field";
import { Icon } from "@makeplane/propel/components/icon";
import { IconButton } from "@makeplane/propel/components/icon-button";
import { ChevronsUpDown, X } from "lucide-react";

const REGIONS = ["us-central-1", "us-east-1", "eu-central-1", "ap-west-1"];

export default function InvalidDemo() {
  return (
    <ComboboxField
      name="region"
      label="Region"
      error="Choose a deployment region."
      magnitude="md"
      items={REGIONS}
      placeholder="e.g. eu-central-1"
      empty="No regions found"
      clear={
        <IconButton
          prominence="ghost"
          tone="neutral"
          magnitude="md"
          aria-label="Clear region"
          icon={<Icon icon={X} />}
        />
      }
      trigger={
        <IconButton
          prominence="ghost"
          tone="neutral"
          magnitude="md"
          aria-label="Open region"
          icon={<Icon icon={ChevronsUpDown} />}
        />
      }
    />
  );
}

Disabled

Filter the deployment region.

Show code
import { ComboboxField } from "@makeplane/propel/components/combobox-field";
import { Icon } from "@makeplane/propel/components/icon";
import { IconButton } from "@makeplane/propel/components/icon-button";
import { ChevronsUpDown, X } from "lucide-react";

const REGIONS = ["us-central-1", "us-east-1", "eu-central-1", "ap-west-1"];

export default function DisabledDemo() {
  return (
    <ComboboxField
      name="region"
      label="Region"
      description="Filter the deployment region."
      magnitude="md"
      disabled
      items={REGIONS}
      placeholder="e.g. eu-central-1"
      empty="No regions found"
      clear={
        <IconButton
          prominence="ghost"
          tone="neutral"
          magnitude="md"
          aria-label="Clear region"
          icon={<Icon icon={X} />}
        />
      }
      trigger={
        <IconButton
          prominence="ghost"
          tone="neutral"
          magnitude="md"
          aria-label="Open region"
          icon={<Icon icon={ChevronsUpDown} />}
        />
      }
    />
  );
}

Installation

import { ComboboxField } from "@makeplane/propel/components/combobox-field";

Props

ComboboxField

PropTypeRequiredDescription
autoCompletestringNoProvides a hint to the browser for autofill. @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete
autoHighlightbooleanNoWhether the first matching item is highlighted automatically while filtering.
highlightItemOnHoverbooleanNoWhether moving the pointer over items should highlight them. Disabling this prop allows CSS `:hover` to be differentiated from the `:focus` (`data-highlighted`) state.
itemToStringLabel((itemValue: Value) => string)NoWhen the item values are objects (`<Combobox.Item value={object}>`), this function converts the object value to a string representation for display in the input. If the shape of the object is `{ value, label }`, the label will be used automatically without needing to specify this prop.
itemToStringValue((itemValue: Value) => string)NoWhen the item values are objects (`<Combobox.Item value={object}>`), this function converts the object value to a string representation for form submission. If the shape of the object is `{ value, label }`, the value will be used automatically without needing to specify this prop.
isItemEqualToValue((itemValue: Value, value: Value) => boolean)NoCustom comparison logic used to determine if a combobox item value matches the current selected value. Useful when item values are objects without matching referentially. Defaults to `Object.is` comparison.
actionsRefRefObject<Actions | null>NoA ref to imperative actions. - `unmount`: Manually unmounts the combobox. Call this after any externally controlled closing animation finishes.
onOpenChange((open: boolean, eventDetails: ChangeEventDetails) => void)NoEvent handler called when the popup is opened or closed.
onInputValueChange((inputValue: string, eventDetails: ChangeEventDetails) => void)NoEvent handler called when the input value changes.
onItemHighlighted((highlightedValue: Value, eventDetails: HighlightEventDetails) => void)NoCallback fired when an item is highlighted or unhighlighted. Receives the highlighted item value (or `undefined` if no item is highlighted) and event details with a `reason` property describing why the highlight changed. The `reason` can be: - `'keyboard'`: the highlight changed due to keyboard navigation. - `'pointer'`: the highlight changed due to pointer hovering. - `'none'`: the highlight changed programmatically.
multiplefalseNoWhether multiple items can be selected.
defaultValueValue | nullNoThe uncontrolled selected value of the combobox when it's initially rendered. To render a controlled combobox, use the `value` prop instead.
valueValue | nullNoThe selected value of the combobox. Use when controlled.
onValueChange((value: Value | null, eventDetails: ChangeEventDetails) => void)NoEvent handler called when the selected value of the combobox changes.
descriptionReactNodeNoSupporting text shown below the input. Replaced by `error` when an error is set.
clearReactElement<unknown, string | JSXElementConstructor<any>>YesThe clear control (e.g. an `IconButton`), rendered as the combobox's clear button. It carries its own — localizable — `aria-label`; the field bakes no label text.
triggerReactElement<unknown, string | JSXElementConstructor<any>>YesThe popup-trigger control (e.g. an `IconButton`), rendered as the combobox's trigger. It carries its own — localizable — `aria-label`; the field bakes no label text.
emptyReactNodeYesMessage rendered when no item matches.
errorReactNodeNoError text shown below the control.
hintReactNodeNoHelper text shown below the control. Replaced by `error` when an error is set.
itemsreadonly Value[]YesItems rendered in the popup.
labelstringYesVisible field label.
magnitude"md" | "lg" | "xl"YesLabel and helper text size.
placeholderstringNoInput placeholder.