Components
PreviousNext

Quick Form

Avoid form redundancy by using a quick form component.

Kit

80% of the time, when you dress a form using react-hook-form and zod :

  • We have to dress a zod schema
  • Set the react-hook-form hooks
  • Calling the same shadcn/ui Form components :
    • FormField
    • FormItem
    • FormLabel
    • FormControl
    • FormMessage
    • ...
  • And we have to do it for each input we create, generating a lot of duplicated code

The QuickForm component is a solution to this redundancy. Set your zod schema and your object config. Then let the component handle the rest.

Installation

Features

  • Avoid form redundancy
  • Typescript auto-completion
  • Zod validation
  • Clean MVC architecture
  • Equivalent component for server side rendering in the kit.

Usage

Quick Form workflow

Quick Form workflow

import { QuickForm, type QuickFormConfig } from '@kit/ui/quick-form';
import { z } from 'zod';
<QuickForm config={{ id: 'my-from', schema: { name: z.string().min(2, 'Please enter at least 2 characters'), email: z.string().email('Please enter a valid email'), phone: z.string().optional().default(''), bio: z.string().max(200, 'Max 200 characters').default(''), }, settings: [ { type: 'wrapper', header: ( <div className="space-y-1"> <h3 className="text-lg font-semibold">Profile</h3> <p className="text-muted-foreground text-sm">Basic information</p> </div> ), settings: [ { type: 'text', slug: 'name', label: 'Name' }, { type: 'text', slug: 'email', label: 'Email' }, { type: 'phone', slug: 'phone', label: 'Phone' }, { type: 'textarea', slug: 'bio', label: 'Bio', description: 'Short bio (max 200 chars)', }, ], }, ], }} defaultValues={{ name: 'John Doe', email: 'john@example.com', phone: '', bio: '', }} onSubmit={(values) => { console.log('QuickForm submitted:', values); }} />

API Reference

Props

QuickFormComponentProps

PropTypeDefault
config*
QuickFormConfig<T, I>
defaultValues
Partial<ExtractQuickFormValues<T>...
onSubmit*
function
inputRenderer
React.ComponentType<{ [key: string]: any; type: string; field: any; slug: string; }>

Config

QuickFormConfig

PropTypeDefault
id*
string
title
string
description
string
className
string
header
React.ReactNode
submitButton
{ text?: string;...
settings*
QuickFormUIConfig<T, I>[]
schema*
T

Inputs

You can find all the inputs available by default here :

PropTypeDefault
text*
function
textarea*
function
phone*
function
select*
function
boolean*
React.FC<BooleanInputProps>
number*
function
color*
function
time*
function
radio*
function
theme*
React.FC<BaseInputProps>

How is this guide?

Last updated on 10/17/2025