Forms are a constant in React applications — from login and registration to complex admin dashboards, nearly every page interacts with user data in some way. The challenge is not just writing forms once, but managing them consistently across large codebases, teams, and projects without accumulating repetitive, hard-to-maintain boilerplate.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/rijvi-mahmud/shaddy/llms.txt
Use this file to discover all available pages before exploring further.
The Problem with Manual Form Management
Libraries likereact-hook-form are excellent for managing form state, and shadcn/ui’s Form component reduces some repetition with render props. But as forms multiply across a project, the same patterns — schema validation, field registration, error display, submit handling — get copy-pasted and drift apart over time.
Shaddy Form takes the approach that a form should be fully described by its schema and submit handler. Everything else — state management, validation, error display, and layout wiring — is handled automatically.
How ShaddyForm Works
ShaddyForm is a generic React component that wraps react-hook-form and Zod. You provide three things:
- A Zod schema that defines the shape and validation rules of your form data.
- Initial values that match the schema’s inferred type.
- An
onSubmithandler that receives fully validated, type-safe data.
ShaddyForm you place Field components — pre-built inputs like TextField, PasswordField, and TextAreaField — that automatically connect to the form’s context with no extra wiring.
Dependency Stack
| Library | Role |
|---|---|
react-hook-form | Form state, validation triggers, field registration |
zod + @hookform/resolvers/zod | Schema-based validation with full TypeScript inference |
shadcn/ui Form | Accessible form primitives (FormField, FormItem, FormMessage) |
Installation
Quick Start Example
Below is a complete form with two fields and a submit button — nouseForm, no Controller, no FormField boilerplate required.
The
onSubmit callback only fires after all Zod validations pass. You never need to manually check isValid before processing submission data.Features
- Schema-driven validation — define once in Zod, enforce everywhere automatically.
- Zero boilerplate — no manual
useForm,Controller, orFormFieldsetup per field. - Type-safe throughout — generics flow from your schema to every field and the submit handler.
- Reusable Field components — built on
shadcn/ui, each field handles its own label, input, and error message. - Custom fields — extend the pattern with your own components using
useFormContext. - Imperative ref access — retrieve the
UseFormReturninstance viareffor advanced use cases. - Flexible validation modes — choose
onChange,onBlur,onSubmit, orall. - Multi-step support — compose with the
Steppercomponent anduseTriggerFormfor step-by-step validation. - Dynamic arrays —
FieldArrayhandles lists of fields powered byuseFieldArray.
Explore the Form System
ShaddyForm
Full API reference for the core
ShaddyForm component, including all props, the ref handle, and validation modes.Form Context
Learn how
FormContext and useFormContext power field components, and how to use useTriggerForm for programmatic validation.What Are Fields
Understand the Field pattern, available built-in fields, and how to create your own custom field components.
FieldArray
Render dynamic, repeating groups of fields with add and remove controls using the
FieldArray component.Multi-Step Form
Build wizard-style multi-step forms with per-step schema validation using
ShaddyForm and Stepper.