Form Builder
A highly advanced, fully declarative schema-driven Form Builder with support for conditional fields, arrays, and nested groups.
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 { FormBuilder } from "@/components/ui/form-builder"
Color Theme
Shape
Spacing
Layout
Named Keys & Props
Pass these exact named keys as props on <FormBuilder />. Click any color pill to copy the prop.
colorDefault is "default"(Black & White)shapeCorner shape"default""square""rounded""sharp"spacingInner spacing"default""2x""4x""6x""8x"Usage Example
A basic implementation example to get you started.
Example Implementation
import { FormBuilder } from"@/components/ui/form-builder";
export default function Example() {
return (
<FormBuilder
schema={[
{ name:"name", type:"text", label:"Name", required: true },
{ name:"emails", type:"array", label:"Emails", fields: [
{ name:"address", type:"email", label:"Email Address"}
]}
]}
onSubmit={(data) => console.log(data)}
/>
);
}Features
Key capabilities and highlights.
Key Capabilities
- ◆Powered by react-hook-form and Zod validation.
- ◆Dynamic field rendering based on strict schema typing.
- ◆Built-in support for nested groups and repeatable array items.
- ◆Includes Auto, Single, Two, and Three column responsive grid layouts.
- ◆Condition evaluation allowing fields to display dynamically based on sibling values.
Notes
Important implementation details to consider.
Implementation Details
- ◆Overview: The FormBuilder allows generating complex, validated forms strictly from a JSON-like schema array.
- ◆Plan: Included in Future UI Monthly & Yearly Premium Plans.
- ◆Schema Configuration: Pass an array of'SchemaField'objects to the'schema'prop.
- ◆Validation: Zod schemas are automatically generated. Custom logic can be supplied via the'validation.custom'callback.
- ◆Conditional Fields: Provide a'showIf: (values) => boolean'callback on any schema field to handle dynamic visibility.
- ◆Arrays and Groups: Set type='array'or type='group'and supply a nested'fields'array to deeply nest inputs.