Standard Form Fields

InputField

InputField connects Ant Design's Input to React Hook Form. It supports inline prefixes (icons), addonBefore/addonAfter (protocols, domain suffixes), max character limits, info tooltips, and custom change listeners.

React Hook Form Controller integration via control prop or safe context fallback
AddonBefore / AddonAfter slots for URL schemes ('https://') and domain extensions ('.com')
Prefix / Suffix slots for icons and status indicators
Info tooltip icon rendered beside the form label
Integrated validation error messages and asterisk for required fields

Props & Configuration

16 props

Complete property specifications, parameter types, and default fallbacks.

PropertyTypeDefaultDescription
idRequiredstring—Form state key name registered in React Hook Form.
controlControl<any>—React Hook Form control instance (optional if inside FormProvider).
labelstring—Field label displayed above the input.
placeholderstring—Watermark placeholder text.
tooltipstring—Informational tooltip text shown next to the label.
helpTextstring—Subordinate hint or disclaimer rendered below the input.
requiredbooleanfalseRenders a red asterisk next to the label.
disabledbooleanfalseDisables user interaction.
prefixReact.ReactNode—Icon or element placed inside the left edge of the input.
suffixReact.ReactNode—Icon or element placed inside the right edge of the input.
addonBeforeReact.ReactNode—Addon box attached before the input.
addonAfterReact.ReactNode—Addon box attached after the input.
maxLengthnumber—Maximum character length permitted.
onChange(val: any) => void—Custom change listener triggered on every keystroke.
rulesRegisterOptions—React Hook Form validation rules (pattern, minLength, required).
spannumber24Grid column span out of 24 when rendered inside DynamicForm rows.

Interactive Examples & Live Previews

3 Demos

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

Example 1

Basic React Hook Form Input

Standard controlled single-line text input with label and placeholder.

Live Interactive Demo
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"}
InputField.basic.tsxtsx
1import React from "react";
2import { useForm } from "react-hook-form";
3import { InputField } from "antd-dynamic-ui";
4
5export default function BasicInputExample() {
6 const { control, handleSubmit } = useForm({
7 defaultValues: { fullName: "Ada Lovelace" },
8 });
9
10 return (
11 <form onSubmit={handleSubmit((d) => console.log(d))} className="max-w-md space-y-4">
12 <InputField
13 id="fullName"
14 control={control}
15 label="Full Name"
16 placeholder="e.g. John Doe"
17 required={true}
18 />
19 </form>
20 );
21}
Example 2

Complete Props with URL Addons & Prefix Icons

Demonstrating addonBefore, addonAfter, prefix icon, tooltip, and live change listener.

Live Interactive Demo
Toggle Props:
disabled:
Input is active & editable
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"}
InputField.complete.tsxtsx
1import React from "react";
2import { useForm } from "react-hook-form";
3import { InputField } from "antd-dynamic-ui";
4import { LinkOutlined } from "@ant-design/icons";
5
6export default function CompleteInputExample() {
7 const { control } = useForm({
8 defaultValues: { customDomain: "acme-corp" },
9 });
10
11 return (
12 <div className="max-w-md space-y-4">
13 <InputField
14 id="customDomain"
15 control={control}
16 label="Custom Subdomain"
17 tooltip="Your public vanity URL endpoint"
18 helpText="Only lowercase letters and hyphens allowed"
19 addonBefore="https://"
20 addonAfter=".saas-hub.io"
21 prefix={<LinkOutlined className="text-zinc-400" />}
22 maxLength={30}
23 required={true}
24 onChange={(val) => console.log("Current value:", val)}
25 />
26 </div>
27 );
28}
Example 3

Declarative DynamicForm Schema Row

How to define InputField in backend JSON schemas for DynamicForm.

Live Interactive Demo
Toggle Props:
disabled:
Input is active & editable
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"}
InputField.schema.tsxtsx
1import { FieldConfig } from "antd-dynamic-ui";
2
3// JSON object sent by backend API
4export const inputFieldSchema: FieldConfig = {
5 id: "corporateEmail",
6 type: "text",
7 label: "Corporate Email Address",
8 placeholder: "alex@company.com",
9 tooltip: "Must match your corporate SSO domain",
10 helpText: "We will send an activation link to this address",
11 required: true,
12 span: 12,
13 validation: {
14 required: true,
15 pattern: "^[a-zA-Z0-9._%+-]+@company\\.com$",
16 customMessage: "Must be a valid @company.com email address",
17 },
18};

Frequently Asked Questions & Quick Solutions

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

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

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

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.