Form
A <form> that never shows the browser's validation popup. It always sets noValidate, so controls keep required and type for assistive tech and keyboards while the caller owns validation.
Use for
- a
<form>element without the browser validation popup - every form in Mosaic, in place of a bare
<form>
Practices
| Guidance | Practice |
|---|---|
| Do | Use Form for every form. Lint flags a bare <form>. |
| Do | When another part owns the node, pass it through that part's render, such as <Card.Content render={<Form id={formId} onSubmit={handleSubmit} />}>. |
| Don’t | Validate in the view or call preventDefault by hand. Use useForm for values, validation and submit. |
API reference
Form
Renders a form, or the render element, with noValidate always set. Forwards its ref.
Examples
A form
<Form onSubmit={form.handleSubmit}>…</Form>