Get up and running with Formedible in under 5 minutes. This guide will walk you through creating a beautiful, type-safe form.
Already familiar with React and Zod? Jump straight to step 1 and have your form running in 2 minutes.
npx shadcn@latest add formedible.dev/r/use-formedible.json
import { z } from "zod";const contactSchema = z.object({name: z.string().min(2, "Name must be at least 2 characters"),email: z.string().email("Please enter a valid email"),message: z.string().min(10, "Message must be at least 10 characters"),});
import { useFormedible } from "@/hooks/use-formedible";export function ContactForm() {const { Form } = useFormedible({schema: contactSchema,fields: [{ name: "name", type: "text", label: "Full Name" },{ name: "email", type: "email", label: "Email Address" },{ name: "message", type: "textarea", label: "Message" },],formOptions: {defaultValues: { name: "", email: "", message: "" },onSubmit: async ({ value }) => {console.log("Form submitted:", value);},},});return <Form />;}
If you run into any issues or have questions, we're here to help.