"use client"; import React from "react"; import Heading from "./heading"; import { z } from "zod"; import { zodResolver } from "@hookform/resolvers/zod"; import { useForm } from "react-hook-form"; import { Button } from "@/ui/button"; import { Textarea } from "@/ui/textarea"; import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage, } from "@/ui/form"; import { Input } from "@/ui/input"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select"; import { cn } from "@/lib/utils"; const formSchema = z.object({ name: z.string().min(2).max(50), email: z.string().email(), budget: z.string(), message: z.string().max(500), }); function ContactForm() { // 1. Define your form. const form = useForm>({ resolver: zodResolver(formSchema), }); // 2. Define a submit handler. function onSubmit(values: z.infer) { // Do something with the form values. // ✅ This will be type-safe and validated. console.log(values); } return (
( Name )} /> ( Email )} />
( Budget )} /> ( Message