Skip to Content

Select Async

An async-loading dropdown that fetches options from an API but does not provide search/filter capability. For searchable async selects, use Combobox with isAsync.


Import

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

Props

PropTypeDefaultDescription
valuestring""Controlled value
onChange(value: string) => voidChange handler
optionsUrlstringAPI endpoint to load options from
placeholderstring"Select..."Placeholder text
disabledbooleanfalseDisable the control
classNamestringAdditional CSS classes

Usage

import { SelectAsync } from "..."; <SelectAsync optionsUrl="/api/categories" value={categoryId} onChange={setCategoryId} placeholder="Select category..." />

Use Combobox with isAsync when users need to search/filter the options. Use SelectAsync for shorter, known lists fetched from an API where search is not needed.


Last updated on