Skip to content
Richard Všianský edited this page Aug 14, 2019 · 1 revision

Form Renderer API

Form Renderer provides a lot of customization via props.

Required props

Prop Type Description
onSubmit func A submit callback which receives two arguments: values from the form, formApi.
schema object A schema which defines structure of the form.
layoutMapper object Defines types of layout components, which can't change the state of the form.
formFieldsMapper object Defines types of form field components. Field components can change the state of the form.

Optional props

Prop Type Description Default
onCancel func A cancel callback.
onReset func A reset callback. You don't need to manually clear the form values!
canReset bool Show/hide reset button
schemaType one of ['mozilla', 'miq', 'default'] x 'default'
buttonsLabels object You can specify custom label for all three form buttons. {submit: 'Submit', cancel: 'Cancel', reset: 'Reset'}
disableSubmit array of strings You can specify a form attributes (see here) which will make the submit button disabled. [ ]
initialValues object Object of fields names as keys and values as their values.
uiSchema object Use when you need to use mozilla schema. { }
buttonOrder array of strings You can specify the order of the form buttons. [ 'submit', 'reset', 'cancel' ]
buttonClassName string Class which will be given to the buttons wrapper. { }
clearOnUnmount bool Will clear values of unmounted components. You can also set this to specific component in the form schema. false
validate func A function which receives all form values and returns an object with errors.
onStateUpdate func A function which will be called with every form update. It receieves values and formApi as arguments.
renderFormButtons one of [node, element, func] x
showFormControls bool x true
Clone this wiki locally