Skip to Content
FrontendBundlesComponentsForm ComponentsCombobox

Combobox

A feature-rich dropdown component that supports search filtering, async data loading, and multi-select. Used internally by RenderFormFields for ColumnTypeEnum.SELECT and ColumnTypeEnum.MANY_TO_MANY fields.


Import

import { Combobox } from "@phpcreation/frontend-components-react-nextjs-bundle/components/Combobox";

Props

PropTypeDefaultDescription
options{ value: string; label: string }[][]Static options list
valuestring | string[]Controlled value
onChange(value: string | string[]) => voidChange handler
placeholderstring"Select..."Placeholder text
isMultibooleanfalseEnable multi-select
isAsyncbooleanfalseEnable async loading
loadOptions(query: string) => Promise<Option[]>Async loader function
disabledbooleanfalseDisable the control
classNamestringAdditional CSS classes

Usage

import { Combobox } from "..."; const statusOptions = [ { value: "draft", label: "Draft" }, { value: "pending", label: "Pending" }, { value: "paid", label: "Paid" }, ]; <Combobox options={statusOptions} value={status} onChange={setStatus} placeholder="Select status..." />

In CRUD forms, RenderFormFields automatically renders Combobox for ColumnTypeEnum.SELECT (with isAsync) and ColumnTypeEnum.MANY_TO_MANY (with isMulti). You only need to use this directly for custom form layouts.


In CRUD Forms

When RenderFormFields renders a SELECT or MANY_TO_MANY field, the Combobox receives:

  • loadOptions — derived from the field’s optionsUrl or optionsArray
  • isMultitrue for MANY_TO_MANY relations
  • isAsynctrue when optionsUrl is set

To use a static options array instead of an API call, set optionsArrayFinite in changes.json:

{ "fields": { "status": { "optionsArrayFinite": "statusOptionsArray" } } }

Last updated on