Form
A Base UI form wrapper for validation, submit handling, and consistent layout.
formlayoutvalidation
Loading preview...
Installation
Run the following command to add the component to your project:
npx baseui-cn add formUsage
import { Button } from "@/components/ui/button"
import { Field, FieldControl, FieldError, FieldLabel } from "@/components/ui/field"
import { Form } from "@/components/ui/form"
;<Form
onFormSubmit={async (values) => {
console.log(values)
}}
>
<Field name="email">
<FieldLabel>Email</FieldLabel>
<FieldControl type="email" placeholder="you@example.com" />
<FieldError />
</Field>
<Button type="submit">Submit</Button>
</Form>
Form Demo
Build an entire Base UI form out of Field parts and keep validation, submission state, and help text consistent.
Loading preview...
Why Use This Wrapper
This keeps the Base UI Form primitive on a project-local import path, gives the form a consistent layout shell, and makes dependent blocks like login and signup install everything they need through the registry.
API Reference
See the Base UI Form documentation for the full API reference, including all props, data attributes, and CSS classes.