Not affiliated with official shadcn/ui. Visit ui.shadcn.com for official docs.
React Number Input Form
A React form with number input and min/max range validation using React Hook Form and Zod coerce for age verification built with shadcn/ui
Looking to implement shadcn/ui patterns?
Join our Discord community for help from other developers.
Age restrictions need validation but HTML inputs return strings. This React form uses z.coerce.number() converting string input to number for validation—minimum 18, maximum 120. Built with shadcn/ui Form components with React Hook Form and type equals number for numeric keyboards, users see You must be at least 18 years old when under minimum. Perfect for age gates, quantity inputs, or any numeric field with range constraints.
Pattern created by @haydenbleasel
Installation
Related patterns you will also like
Simple Text Input Form
Basic text validation without numeric rules
URL Input Form
URL validation with schema
Simple Slider
Range input with visual slider
Simple Input with Label
Basic input without validation
Search Input Form
Search field with validation
Range Slider
Min and max range selection
Questions you might have
React Password Input Form
A React form with password input and minimum length validation using React Hook Form and Zod for secure account creation built with shadcn/ui
React URL Input Form
A React form with URL input validation using React Hook Form and Zod url schema for website or portfolio links built with shadcn/ui