SelectApiField
SelectApiField queries remote REST endpoints as the user types, debouncing queries with AbortController cancellation to eliminate stale responses.
Props & Configuration
9 propsComplete property specifications, parameter types, and default fallbacks.
| Property | Type | Default | Description |
|---|---|---|---|
| idRequired | string | — | Form state key name. |
| controlRequired | Control<any> | — | React Hook Form control instance. |
| apiUrlRequired | string | — | Remote endpoint URL to fetch options from. |
| searchParam | string | "search" | Query parameter name sent with user search text. |
| labelPath | string | "value" | Key in response object to use as option label. |
| valuePath | string | "key" | Key in response object to use as option value. |
| debounceMs | number | 400 | Debounce delay in milliseconds before querying API. |
| limit | number | 50 | Max results per page. |
| extraParams | Record<string, any> | — | Static query parameters sent with every request. |
Interactive Examples & Live Previews
2 DemosEvery example includes its own live, interactive preview element alongside the corresponding copyable TypeScript snippet.
Basic Remote User Search
Search remote users endpoint with debounced queries.
Automatically debounces search keystrokes and updates options asynchronously.
1import React from "react";2import { useForm } from "react-hook-form";3import { SelectApiField } from "antd-dynamic-ui";45export default function BasicRemoteSelect() {6 const { control } = useForm();7 return (8 <div className="max-w-md">9 <SelectApiField10 id="assignee"11 control={control}12 apiUrl="/api/v1/team/members"13 searchParam="search"14 label="Task Assignee"15 placeholder="Type name or email to search..."16 />17 </div>18 );19}
Complete Props with Custom Keys & Extra Filters
Remote select with custom JSON paths, department filter, and 500ms debounce.
Automatically debounces search keystrokes and updates options asynchronously.
1import React from "react";2import { useForm } from "react-hook-form";3import { SelectApiField } from "antd-dynamic-ui";45export default function CompleteRemoteSelect() {6 const { control } = useForm();7 return (8 <div className="max-w-md">9 <SelectApiField10 id="customerId"11 control={control}12 apiUrl="/api/v2/crm/accounts"13 searchParam="query"14 labelPath="companyName"15 valuePath="accountId"16 debounceMs={500}17 extraParams={{ activeOnly: true, region: "EMEA" }}18 label="Corporate Client"19 placeholder="Search EMEA accounts..."20 mode="multiple"21 />22 </div>23 );24}
Expected Backend API Response Schema
Ensure your backend endpoint returns JSON matching this exact structure to prevent hydration and rendering errors.
Expected API Response Payload
Your backend API must return JSON matching this exact structure.
{
"success": true,
"data": [
{
"key": "usr_101",
"value": "Ada Lovelace (ada@computing.org)"
},
{
"key": "usr_102",
"value": "Alan Turing (alan@bletchley.uk)"
}
]
}Frequently Asked Questions & Quick Solutions
Architectural patterns, React 19 compatibility, and integration tips for SelectApiField.
How does SelectApiField integrate with Ant Design 5.x and Next.js 15?▼
SelectApiField is designed as an enhanced, declarative wrapper for Ant Design. It fully supports Next.js 15 App Router when using @ant-design/nextjs-registry, eliminating SSR hydration mismatches and guaranteeing 0ms layout thrashing.
Can I customize validation, themes, and props for SelectApiField?▼
Yes. Every prop is fully typed in TypeScript 5 with comprehensive Intellisense. You can pass custom styling via className or style props, configure global Ant Design themes via ConfigProvider, and extend validation logic seamlessly.