PasswordField
PasswordField masks sensitive credentials with eye icon toggle buttons, caps lock detection, and seamless React Hook Form integration.
Props & Configuration
8 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 text. |
| placeholder | string | — | Placeholder text. |
| tooltip | string | — | Helpful tooltip next to label. |
| required | boolean | false | Required asterisk indicator. |
| prefix | React.ReactNode | — | Prefix icon. |
| rules | RegisterOptions | — | Validation rules (minLength, pattern). |
Interactive Examples & Live Previews
2 DemosEvery example includes its own live, interactive preview element alongside the corresponding copyable TypeScript snippet.
Basic Password Input
Masked password entry with eye visibility toggle.
1import React from "react";2import { useForm } from "react-hook-form";3import { PasswordField } from "antd-dynamic-ui";45export default function BasicPasswordExample() {6 const { control } = useForm();7 return (8 <div className="max-w-md">9 <PasswordField10 id="password"11 control={control}12 label="Account Password"13 placeholder="Enter at least 8 characters"14 required={true}15 />16 </div>17 );18}
Complete Props with Lock Icon & Tooltip
Password field with prefix lock icon, security tooltip, and minLength rules.
1import React from "react";2import { useForm } from "react-hook-form";3import { PasswordField } from "antd-dynamic-ui";4import { LockOutlined } from "@ant-design/icons";56export default function CompletePasswordExample() {7 const { control } = useForm();8 return (9 <div className="max-w-md">10 <PasswordField11 id="securityToken"12 control={control}13 label="Master Encryption Key"14 placeholder="Enter 16+ character passphrase"15 tooltip="Used for end-to-end payload signing"16 prefix={<LockOutlined className="text-zinc-400" />}17 required={true}18 rules={{ minLength: { value: 16, message: "Key must be at least 16 chars" } }}19 />20 </div>21 );22}
Frequently Asked Questions & Quick Solutions
Architectural patterns, React 19 compatibility, and integration tips for PasswordField.
How does PasswordField integrate with Ant Design 5.x and Next.js 15?▼
PasswordField 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 PasswordField?▼
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.