Standard Form Fields

SelectField

SelectField normalizes options arrays into { key, value } pairs, supports single and multiple selection modes, clearable options, and an embedded '+ Create New' action button.

Key-value option normalization ({ key: 'us', value: 'United States' })
Mode support: 'multiple' (tags) and standard single select
Create action: embed a '+ Add Option' action directly inside the dropdown menu
Key filtering with hideKeys prop

Props & Configuration

8 props

Complete property specifications, parameter types, and default fallbacks.

PropertyTypeDefaultDescription
idRequiredstring—Form state key name.
controlRequiredControl<any>—React Hook Form control instance.
optionsRequiredFieldOption[]—Array of { key: string, value: string } options.
mode"multiple" | "tags"—Enables multi-tag selection mode.
showSearchbooleantrueEnables text filtering across options.
allowClearbooleantrueShows a cross icon to clear selection.
createSelectCreateAction—Config for '+ Add New' button inside dropdown footer.
hideKeys(string | number)[]—List of keys to omit from the dropdown list.

Interactive Examples & Live Previews

2 Demos

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

Example 1

Basic Dropdown Selector

Standard single-select dropdown with key-value pairs.

Live Interactive Demo
Content Editor (Publish & Draft)
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"}
SelectField.basic.tsxtsx
1import React from "react";
2import { useForm } from "react-hook-form";
3import { SelectField } from "antd-dynamic-ui";
4
5export default function BasicSelect() {
6 const { control } = useForm();
7 const roles = [
8 { key: "admin", value: "Administrator" },
9 { key: "editor", value: "Editor" },
10 { key: "viewer", value: "Viewer" },
11 ];
12
13 return (
14 <div className="max-w-md">
15 <SelectField
16 id="role"
17 control={control}
18 label="User Role"
19 placeholder="Select access tier"
20 options={roles}
21 />
22 </div>
23 );
24}
Example 2

Multi-Select Mode with In-Menu '+ Add Option' Action

Multi-tag selection with search filter and an embedded create new option button.

Live Interactive Demo
Toggle Props:
disabled:
Input is active & editable
Content Editor (Publish & Draft)
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"}
SelectField.complete.tsxtsx
1import React, { useState } from "react";
2import { useForm } from "react-hook-form";
3import { SelectField } from "antd-dynamic-ui";
4import { PlusOutlined } from "@ant-design/icons";
5
6export default function MultiSelectWithCreate() {
7 const { control } = useForm({ defaultValues: { tags: ["react", "typescript"] } });
8 const [tagOptions, setTagOptions] = useState([
9 { key: "react", value: "React 19" },
10 { key: "typescript", value: "TypeScript 5.8" },
11 { key: "tailwind", value: "Tailwind CSS" },
12 ]);
13
14 return (
15 <div className="max-w-md">
16 <SelectField
17 id="tags"
18 control={control}
19 label="Project Technologies"
20 placeholder="Select or add tags"
21 options={tagOptions}
22 mode="multiple"
23 showSearch={true}
24 allowClear={true}
25 create={{
26 label: "Add New Technology Tag",
27 icon: <PlusOutlined />,
28 onClick: () => {
29 const newTag = prompt("Enter new tag name:");
30 if (newTag) {
31 setTagOptions((prev) => [...prev, { key: newTag.toLowerCase(), value: newTag }]);
32 }
33 },
34 }}
35 />
36 </div>
37 );
38}

Frequently Asked Questions & Quick Solutions

Architectural patterns, React 19 compatibility, and integration tips for SelectField.

How does SelectField integrate with Ant Design 5.x and Next.js 15?▼

SelectField 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 SelectField?▼

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.