NumberField
NumberField handles numeric values, currencies, percentages, and quantities with precision controls, step increments, and unit addons.
Props & Configuration
9 propsComplete property specifications, parameter types, and default fallbacks.
| Property | Type | Default | Description |
|---|---|---|---|
| idRequired | string | — | Form state key name. |
| control | Control<any> | — | React Hook Form control instance. |
| label | string | — | Field label. |
| min | number | — | Minimum allowed number. |
| max | number | — | Maximum allowed number. |
| step | number | 1 | Increment step size. |
| precision | number | — | Number of decimal places. |
| prefix | React.ReactNode | — | Prefix icon or currency symbol. |
| addonAfter | React.ReactNode | — | Trailing unit label (e.g. 'USD'). |
Interactive Examples & Live Previews
2 DemosEvery example includes its own live, interactive preview element alongside the corresponding copyable TypeScript snippet.
Basic Quantity Stepper
Integer quantity selector with min/max bounds.
1import React from "react";2import { useForm } from "react-hook-form";3import { NumberField } from "antd-dynamic-ui";45export default function BasicNumber() {6 const { control } = useForm({ defaultValues: { qty: 1 } });7 return (8 <div className="max-w-xs">9 <NumberField10 id="qty"11 control={control}12 label="Order Quantity"13 min={1}14 max={100}15 step={1}16 />17 </div>18 );19}
Complete Currency Input with Precision
Decimal price input with currency prefix and USD unit addon.
1import React from "react";2import { useForm } from "react-hook-form";3import { NumberField } from "antd-dynamic-ui";45export default function CurrencyNumber() {6 const { control } = useForm({ defaultValues: { unitCost: 49.99 } });7 return (8 <div className="max-w-xs">9 <NumberField10 id="unitCost"11 control={control}12 label="Unit Cost"13 min={0}14 step={0.01}15 precision={2}16 prefix="$"17 addonAfter="USD"18 required={true}19 />20 </div>21 );22}
Frequently Asked Questions & Quick Solutions
Architectural patterns, React 19 compatibility, and integration tips for NumberField.
How does NumberField integrate with Ant Design 5.x and Next.js 15?▼
NumberField 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 NumberField?▼
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.