UI Schema
UI schema allows you to customize the appearance of the form and influence its behavior.
The UI schema object follows the tree structure of the form field hierarchy, and defines how each property should be rendered.
Each UI schema node may contain the following fields:
ui:options
- Set of ui options (see below)ui:widget
- Widget type or a custom widget component (should have compatible value types)ui:field
- Field type or a custom field componentui:templates
- Key value pairs (record) of template type to a different template type or a custom template componentui:components
- Key value pairs (record) of component type to a different component type or custom componentitems
- UI schema or array of UI schema for array itemsanyOf
,oneOf
- Array of UI schemaadditionalProperties
,additionalItems
- UI schema for additional properties and itemsadditionalPropertyKeyInput
- UI schema for additional property key input
UI schema root
Root node of UI schema can have an additional fields:
ui:rootFieldId
- prefix of generated field idsui:globalOptions
- global ui options that are applied to all fields, are overwritten byui:options
.ui:submitButton
- submit button UI schemaui:formElement
- form element UI schema
UI options
UI schema evaluation rules
Usually ui schema corresponds to the data structure described by json schema.
For example, with this json schema, the following ui schema would be correct:
Special cases:
Array
Instead of defining indices in the ui schema, the items
keyword should be used
to specify the ui schema for the elements of the array.
For a fixed array items
also can be an array.
If you have additional items you should use additionalItems
keyword
to specify the ui schema for them.
Object
You should use additionalProperties
keyword to specify the ui schema for
additional properties.
You can use additionalPropertyKeyInput
keyword to define an ui schema for
the additional property key input field.
oneOf/anyOf
You can define separate ui schemas for each oneOf/anyOf
branch
using the corresponding keyword in the ui schema.
Otherwise the ui schema of the current field will be used.