What problem does it solve?
This Skill provides a structured approach to building robust, maintainable forms in React using React Hook Form and Zod validation. It covers common patterns for creating, editing, and validating forms, including support for dynamic fields and server mutations.
Core Features & Use Cases
- Form setup & validation using RHF + Zod resolvers to enforce schemas and defaults.
- Edit forms with unsaved changes using useFormState and an UnsavedChangesBar for a safe UX.
- Array and dynamic fields with useFieldArray to manage lists of inputs like emails or tags.
- tRPC integration for submitting form data and handling server responses with proper error handling and query invalidation.
- Field components using Field, FieldLabel, FieldError, Input, Select, and other UI primitives for accessibility.
Quick Start
Create a basic form using React Hook Form and Zod with fields email and password and basic validation. Then extend to an array field and an edit form with unsaved changes.