Standard Form FieldsDebounced Async Query

SelectApiField

SelectApiField queries remote REST endpoints as the user types, debouncing queries with AbortController cancellation to eliminate stale responses.

Debounced remote querying (400ms configurable debounceMs)
AbortController request cancellation prevents out-of-order responses
Configurable labelPath and valuePath for arbitrary backend JSON responses
Supports multi-select mode and initialValue pre-hydration

Props & Configuration

9 props

Complete property specifications, parameter types, and default fallbacks.

PropertyTypeDefaultDescription
idRequiredstring—Form state key name.
controlRequiredControl<any>—React Hook Form control instance.
apiUrlRequiredstring—Remote endpoint URL to fetch options from.
searchParamstring"search"Query parameter name sent with user search text.
labelPathstring"value"Key in response object to use as option label.
valuePathstring"key"Key in response object to use as option value.
debounceMsnumber400Debounce delay in milliseconds before querying API.
limitnumber50Max results per page.
extraParamsRecord<string, any>—Static query parameters sent with every request.

Interactive Examples & Live Previews

2 Demos

Every example includes its own live, interactive preview element alongside the corresponding copyable TypeScript snippet.

Example 1

Basic Remote User Search

Search remote users endpoint with debounced queries.

Live Interactive Demo
Type to search remote users...

Automatically debounces search keystrokes and updates options asynchronously.

React Hook Form Live State:{"testInput":"Sample text","testPassword":"secretPassword123","testSelect":"editor","testNumber":42,"testTextArea":"This is a multi-line text area content for enterprise use.","testSwitch":true,"testCheckbox":true,"testRadio":"b","testSlider":65,"testRating":4,"testColor":"#e05d44","testCountry":"US","testPhone":"+1 (555) 019-2834","testOtp":"123456"}
SelectApiField.basic.tsxtsx
1import React from "react";
2import { useForm } from "react-hook-form";
3import { SelectApiField } from "antd-dynamic-ui";
4
5export default function BasicRemoteSelect() {
6 const { control } = useForm();
7 return (
8 <div className="max-w-md">
9 <SelectApiField
10 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}
Example 2

Complete Props with Custom Keys & Extra Filters

Remote select with custom JSON paths, department filter, and 500ms debounce.

Live Interactive Demo
Toggle Props:
disabled:
Input is active & editable
Type to search remote users...

Automatically debounces search keystrokes and updates options asynchronously.

React Hook Form Live State:{"testInput":"Sample text","testPassword":"secretPassword123","testSelect":"editor","testNumber":42,"testTextArea":"This is a multi-line text area content for enterprise use.","testSwitch":true,"testCheckbox":true,"testRadio":"b","testSlider":65,"testRating":4,"testColor":"#e05d44","testCountry":"US","testPhone":"+1 (555) 019-2834","testOtp":"123456"}
SelectApiField.complete.tsxtsx
1import React from "react";
2import { useForm } from "react-hook-form";
3import { SelectApiField } from "antd-dynamic-ui";
4
5export default function CompleteRemoteSelect() {
6 const { control } = useForm();
7 return (
8 <div className="max-w-md">
9 <SelectApiField
10 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.