Forms/Smart Form

SmartForm

Pass a Zod schema and get a fully wired form — field components, validation, error display, and loading state. No react-hook-form setup, no manual error wiring.

import { SmartForm, FormField, FormSubmit } from "@animui/ui"

Contact form example

Try submitting with empty or invalid fields to see validation.

Props

PropTypeDefaultDescription
schemaZodSchemaA Zod schema object. SmartForm infers field types and validation rules automatically.
onSubmit(data: z.infer<typeof schema>) => Promise<void>Called with validated form data on submit. SmartForm shows a loading state during the async operation.
defaultValuesPartial<z.infer<typeof schema>>Pre-fill form fields with initial values.
resetOnSuccessbooleanfalseResets all fields to defaultValues after a successful submit.
classNamestringAdditional classes on the form element.
© 2026 Steal Shadow. MIT License.Report an issue