Dinachi

Form

A native form wrapper with consolidated error handling built on Base UI foundations.

#Installation

npx @dinachi/cli@latest add form

#Usage

tsx
import { Form } from "@/components/ui/form"

#Examples

Default Form

A basic form with field components

Form with Validation

Form with error handling on submit

Contact Form

A complete contact form with multiple field types

#API Reference

PropTypeDefaultDescription
errorsRecord<string, string | string[]>{}Object keyed by field name with validation messages.
onClearErrors(errors: Record<string, string | string[]>) => voidCallback fired when errors should be cleared.
onSubmit(event: React.FormEvent<HTMLFormElement>) => voidForm submit handler.
renderReact.ReactElement | ((props, state) => React.ReactElement)<form />Optional custom render element using Base UI's render pattern.