Layouts
Layout elements in the UI Schema contain other UI Schema elements like controls or other layouts and serve the purpose of defining the layout of those, e.g. a layout could arrange all its contained UI Schema Elements into a horizontal alignment.
elements
#
All layouts need to declare an elements
property which contains the children which are to be arranged by the layout.
It is expected to be an array of UI Schema elements, e.g. controls or other layouts.
type
#
By default, JSON Forms supports four different kinds of layouts: VerticalLayout
and HorizontalLayout
, a slightly modified version of the vertical layout called Group
as well Categorization
, which is often used to bundle related data, for instance by means of Tabs.
Those four core layouts are detailed in the following.
#
HorizontalLayoutAPIHorizontal layouts use the HorizontalLayout
type and arranges its contained elements
in a horizontal fashion.
Each child occupies the same amount of space, i.e. for n children a child occupies 1/n space.
#
VerticalLayoutAPIVertical Layouts use the VerticalLayout
type and arranges its elements
in a vertical fashion, i.e. all elements are placed beneath each other.
#
GroupAPIGroups are very similar to VerticalLayout
s but feature an additional mandatory label
property
that is used to describe the elements
.
label
#
The label property defines an additional string that is used to describe the elements of the Group.
#
CategorizationAPICategorization uses the Categorization
type and can only contain elements
of type Category
. A Category
itself acts as a container and has an elements
of its own as well as a label
that describes the contained data.
Categorizations are typically used to structure controls with related data, e.g. 'Personal Data' and 'Dietary requirements' as demonstrated in example below.
In the example above note how each child within the elements is of type Category.
Demo