Launch sale — 60% off Pro
Contact
FormValidation

Not affiliated with official shadcn/ui. Visit ui.shadcn.com for official docs.

React Form - Conditional Validation

A React form with conditional validation using Zod refine and form watch showing and validating company fields only when checkbox is checked built with shadcn/ui

Looking to implement shadcn/ui patterns?

Join our Discord community for help from other developers.


Not all forms need the same fields for everyone. This React form uses shadcn/ui Checkbox with form.watch to show company fields only when users check I have a company—then Zod .refine validates those fields as required. Built with React Hook Form and conditional rendering with checkbox state, it's perfect for optional sections, progressive disclosure, or any form where field requirements depend on user choices.

Check this if you represent a company.

Pattern created by @haydenbleasel

Installation

Questions you might have