Dynamic Form System
A production-ready, enterprise-grade form system for React + TypeScript. Powered by React Hook Form and Zod, it supports dynamic field generation from configuration objects, automatic validation, complex conditional rendering, multi-step wizards, custom field injection, auto-save state, and multiple premium SaaS design variants.
form Premium Plan
Availability
Included in Premium Plans
This flagship component is part of Future UI's monthly & yearly Premium plans and is not distributed via the free public CLI.
Import
import { OTPInput } from "@/components/ui/dynamic-form"
Layout Variant
Color Theme
Style
Shape
Spacing
Size
Named Keys & Props
Pass these exact named keys as props on <OTPInput />. Click any color pill to copy the prop.
colorDefault is "default"(Black & White)variantVisual style"default""premium""clean""solid""floating""minimal""modern""glass""outline""elevated""dark""compact"shapeCorner shape"default""square""rounded""sharp"spacingInner spacing"default""2x""4x""6x""8x"sizeComponent size"default""sm""md""lg""xl""2xl"Usage Example
A basic implementation example to get you started.
Example Implementation
import { DynamicForm, FieldConfig } from"@/components/ui/dynamic-form";
import { Mail, Lock, User } from"lucide-react";
const fields: FieldConfig[] = [
{
name:"name",
type:"text",
label:"Full Name",
placeholder:"Enter your full name",
required: true,
icon: User,
colSpan: 1
},
{
name:"email",
type:"email",
label:"Email Address",
placeholder:"you@example.com",
required: true,
icon: Mail,
colSpan: 1
},
{
name:"password",
type:"password",
label:"Password",
placeholder:"••••••••",
required: true,
icon: Lock,
colSpan: 1
},
{
name:"role",
type:"select",
label:"Role",
required: true,
options: [
{ label:"Developer", value:"dev"},
{ label:"Designer", value:"design"}
],
colSpan: 1
},
{
name:"notifications",
type:"switch",
label:"Enable push notifications",
defaultValue: true,
colSpan:"full"
}
];
export default function Example() {
return (
<div className="max-w-md w-full mx-auto p-6 bg-card border rounded-2xl shadow-sm">
<h2 className="text-xl font-bold mb-4">Create Account</h2>
<DynamicForm
variant="modern"
fields={fields}
submitButtonText="Sign Up"
onSubmit={(data) => console.log("Submitted:", data)}
/>
</div>
);
}Features
Key capabilities and highlights.
Key Capabilities
- ◆Dynamic field generation: Render standard inputs, password eyes, OTP grids, autocomplete comboboxes, rich file uploads, multi-selects, switches, and custom fields from simple configurations.
- ◆Zod Schema Builder: Automatically constructs an optimized Zod validation schema on the fly, or allows developers to supply their own Zod schema.
- ◆Premium Styling Variants: Out-of-the-box support for seven aesthetic variants (modern, minimal, glass, outline, elevated, dark, compact) using a strict 4px spacing system.
- ◆Asynchronous API Submission: Built-in endpoint integration with automated loading triggers, success alerts, and error feedback callbacks.
- ◆Step Stepper / Wizard Flow: Group fields into multi-step form sequences with independent validations per step.
- ◆Autosave Feature: Option to persist form progress securely in localStorage with custom debounced timing.
- ◆Conditional Fields: Clean visibility triggers that evaluate dependencies based on live form values.
Notes
Important implementation details to consider.
Implementation Details
- ◆Plan: Included in Future UI Monthly & Yearly Premium Plans.
- ◆Import:'import { DynamicForm, FieldConfig } from "@/components/ui/dynamic-form";'
- ◆Fields Config: Define an array of'FieldConfig'objects specifying'name','type','label','required', and validation constraints.
- ◆Variants: Toggle between'minimal','modern','glass','outline','elevated','dark', and'compact'to match your page aesthetics.
- ◆Steppers & Wizards: Group fields into multi-step paths by passing the'steps'prop with grouped fieldNames.
- ◆API Callbacks: Configure direct form submissions by setting the'api'prop with an endpoint URL, and handle responses via'onSuccess'and'onError'callbacks.