Overview
Render an accessible form from a JSON Schema object and submit one validated value.
Usage
SchemaForm always renders a real <form> and a hidden serialized output field. After valid submission, readSchemaFormData(new FormData(form), 'payload') returns the same object delivered to onsubmit.
The three value channels have distinct ownership. value seeds internal state on mount and is not a live binding, so later value changes do not discard active edits. onDraftChange reports the complete current draft after each edit, before schema validation, so consumers can mirror nested or temporarily invalid values. In-progress numeric editors and temporarily unparseable JSON fields are reported as their current raw text until the value commits or parses successfully. onsubmit reports only schema-valid output after submission.
When to use
- Capturing a payload whose shape is already described by a workflow, API, or JSON Schema document.
- You need callback submission and native FormData submission to expose the same validated object.
- Authoring or editing a JSON Schema document — use json-schema-editor instead.
- You need bespoke multi-step flows or custom cross-field user interface beyond schema validation.
Examples
JSON Schema
Render and submit a payload from a JSON Schema object.
Props
| Name | Type | Default | Required | Bindable | Description |
|---|---|---|---|---|---|
schema | Schema | req | JSON Schema object used to render and validate the form. |