base-ui-svelte

Form

A form root that coordinates field validation and submit handling.

View as Markdown

API Reference

Props mirror Base UI React where applicable, adapted for Svelte 5. Native HTML attributes for the rendered element are also accepted unless noted.

Form

A native form element with consolidated error handling. Renders a <form> element.

Props

errors FormErrors —
Name
errors
Description

Validation errors returned externally, typically after submission by a server or a form action. This should be an object where keys correspond to the name attribute on <Field.Root>, and values correspond to error(s) related to that field.

Type
FormErrors | undefined
onFormSubmit function —
Description

Event handler called when the form is submitted. preventDefault() is called on the native submit event when used.

Type
((formData: FormData, event: SubmitEvent) => void)
| undefined
children snippet —
Description

Content rendered inside the part.

Type
Snippet