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
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | "" | Controlled value |
onChange | (value: string) => void | — | Change handler |
optionsUrl | string | — | API endpoint to load options from |
placeholder | string | "Select..." | Placeholder text |
disabled | boolean | false | Disable the control |
className | string | — | Additional 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.
Related
- Combobox — async with search support
- Select — static dropdown (no async)
- Render Form Fields
Last updated on