Skip to main content

Basic Form

<RavenForm> is the main component for rendering a single-page form from a schema.

Minimal Example​


RavenForm Props​

PropTypeDescription
schemaFormSchemaRequired. The field definitions
onSubmit(values) => void | Promise<void>Required. Submit handler
defaultValuesRecord<string, unknown>Pre-fill form values
adapterFormAdapterOverride the global form adapter
uiUIAdapterOverride the global UI adapter
submitLabelstringLabel for the submit button
showResetbooleanShow the reset button
showStateInspectorbooleanShow inline state inspector (dev only)
classNamestringCSS class for the form element

Default Values​


Conditional Fields​

hidden and disabled accept a static boolean or a function of form values:

In RavenForm this field is hidden until the checkbox is checked via: hidden: (values) => !values.hasPromo

tip

Add field names to dependsOn so the engine knows which fields to watch when re-evaluating hidden / disabled functions.


Inline State Inspector​

πŸ› Form State Inspector
{
  "values": {
    "username": "",
    "active": false
  },
  "errors": {},
  "touched": {}
}