Form
Native form with consolidated Field validation and optional server error maps.
Examples
Submit
Overview
Form wraps fields and calls onFormSubmit with values after validation. Pass errors for server-side messages keyed by Field name.
tsx
import { Form, Field, FieldLabel, FieldControl, Button } from "@standard-ui/react" <Form onFormSubmit={(values) => { /* … */ }}> <Field name="email"> <FieldLabel>Email</FieldLabel> <FieldControl type="email" required /> </Field> <Button type="submit">Submit</Button> </Form>
API
| Prop | Role |
|---|---|
| validationMode | onSubmit, onBlur, or onChange. |
| errors | External/server errors keyed by field name. |
| onFormSubmit | Called with values after client validation passes. |
Guidelines
Do
- Give every Field a stable name
- Map server errors into the errors prop
Don't
- Don't nest forms
- Don't rely only on visual cues — keep FieldError text