Skip to main content

Layout components

The next generation content form includes two ways of specifying the layout of a form: tabs and grids. These features allow you to specify how properties in the form are laid out and to make the form easier to use by grouping related properties together.

Grids
Link copied!

The grid component allows you to group related properties in columns and specify how these columns should be displayed.

Parameters
Link copied!

ParamTypeDescription
namestringgrid
numColumnsintegerThe number of columns in each row.
columnsarrayThe span of each group of columns and the properties it contains

The span parameter specifies how many columns each column group takes up. Each item in the columns arrays includes span and a pointers array containing the properties contained within it.

Grid example
Link copied!

In the example schema shown below, the image properties are grouped together in a grid divided into 12 columns, with each property laid out using 6 columns, or half the available space.

{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://example.com/grid-test",
"title": "Title",
"description": "Description",
"allOf": [
{
"$ref": "http://bigcontent.io/cms/schema/v1/core#/definitions/content"
}
],
"type": "object",
"properties": {
"imageLinkGrid": {
"type": "object",
"properties": {
"imageLink": {
"title": "Image Link",
"allOf": [
{
"$ref": "http://bigcontent.io/cms/schema/v1/core#/definitions/image-link"
}
]
},
"imageAltText": {
"type": "string",
"title": "Image alt text",
"ui:component": {
"name": "text-area",
"params": {
"placeholder": "Description of image for alt tag"
}
}
},
"isSVG": {
"type": "boolean",
"title": "Image SVG",
"description": "Check if image is an SVG"
},
"imageLinkHref": {
"type": "string",
"title": "Image URL",
"format": "uri",
"ui:component": {
"name": "text-area",
"params": {
"placeholder": "https://..."
}
}
},
"imageTarget": {
"title": "Image Link Target",
"type": "string",
"oneOf": [
{
"title": "New Tab",
"const": "_blank"
},
{
"title": "Same Tab",
"const": "_self"
}
]
}
},
"ui:component": {
"name": "grid",
"params": {
"numColumns": 12,
"columns": [
{
"span": 6,
"pointers": ["/imageLink", "/isSVG"]
},
{
"span": 6,
"pointers": ["/imageAltText", "/imageLinkHref", "/imageTarget"]
}
]
}
}
}
},
"propertyOrder": []
}

Grid example content form
Link copied!

The content form for the example grid schema is shown below. The Image Link and Image SVG are aligned in one section of the grid, while Image Alt Text, Image URL and Image Link target are grouped on the other.

The image properties are grouped together in a grid

Tabs
Link copied!

The tabs component allows you to organise your form so it can be navigated using tabs. You may choose to add advanced options in a separate tab and keep the most commonly used properties in the main tab, for example.

Specify the tab labels, the default tab and the properties that will be included in each tab.

You can find a more advanced tabs example, with vertical tabs, in the schema examples.

Parameters
Link copied!

ParameterDescription
nametabs
defaultTabThe name of the tab that will be selected initially
orientationHow the tabs are displayed. horizontal (default) or vertical
variantdefault or outline. Should an outline be displayed around the selected tab.
growtrue or false (default). Should the tabs expand to fit the size of the form.
itemsAn array of tabs.
For each entry in the items array there is a label and a pointers array that contains the property names in JSON pointer format. See example.

Tabs example
Link copied!

In the simple schema shown below, there are two tabs: image and video, each containing a property for the media itself and a string field.

{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://example.com/tabbed-media",
"title": "Image and video tabs",
"description": "Example showing the use of tabs",
"allOf": [
{
"$ref": "http://bigcontent.io/cms/schema/v1/core#/definitions/content"
}
],
"type": "object",
"properties": {
"image": {
"title": "Image",
"allOf": [
{
"$ref": "http://bigcontent.io/cms/schema/v1/core#/definitions/image-link"
}
]
},
"altimagetext": {
"title": "Alt image text",
"description": "The text to be displayed if the image cannot be displayed",
"type": "string",
"minLength": 0,
"maxLength": 100
},
"video": {
"title": "video",
"allOf": [
{
"$ref": "http://bigcontent.io/cms/schema/v1/core#/definitions/video-link"
}
]
},
"videotitle": {
"title": "Video title",
"description": "Enter the title for the video",
"type": "string",
"minLength": 0,
"maxLength": 50
}
},
"ui:component": {
"name": "tabs",
"params": {
"tabs": {
"defaultTab": "Image",
"items": [
{
"label": "Image",
"pointers": ["/image", "/altimagetext"]
},
{
"label": "Video",
"pointers": ["/video", "/videotitle"]
}
]
}
}
},
"propertyOrder": []
}

Tabs example content form
Link copied!

The content form for the example schema is shown below, including the "image" and "video" tabs.

The content form showing the image and video tabs

Divider
Link copied!

A divider is a line of variable width, with an optional label. It’s particularly useful for labelling groups of properties to create notional sections that don’t impact output.

Parameters
Link copied!

ParamDescription
namedivider
labelThe label shown on the divider
labelPositionThe divider label alignment. left, right or center (default).
sizeThe divider line size. xs (default), sm, md, lg, xl or xxl.
Note that the size of the label will not be changed
variantThe divider line style. dotted or dashed. A solid line will be used by default if variant is not specified

Divider example
Link copied!

In the example below, the numberDivider property includes a label and has a line size set to medium. The divider will not be included in the JSON output for the content item.

In this example the divider acts as a heading for a group of number properties (taken from the number schema example).

{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://schema-examples.com/next-gen-divider",
"title": "Title",
"description": "Description",
"allOf": [
{
"$ref": "http://bigcontent.io/cms/schema/v1/core#/definitions/content"
}
],
"type": "object",
"properties": {
"numberDivider": {
"type": "string",
"ui:component": {
"name": "divider",
"params": {
"label": "Number examples",
"size": "md"
}
}
},
"percentValue": {
"type": "integer",
"title": "Percentage",
"description": "Shows use of the suffix parameter",
"examples": [
"20%",
"40%",
"65%"
],
"minimum": 0,
"maximum": 100,
"ui:component": {
"params": {
"placeholder": "50%",
"variant": "filled",
"suffix": "%",
"allowNegative": false
}
}
},
"temperature": {
"type": "number",
"title": "Number Temperature",
"examples": [
"2.5",
"3.7"
],
"minimum": -10,
"maximum": 10,
"ui:component": {
"params": {
"suffix": "°",
"allowNegative": true,
"step": 0.1,
"precision": 1
}
}
},
"sliderInteger": {
"type": "integer",
"description": "A slider with labels",
"ui:component": {
"name": "slider",
"params": {
"placeholder": "Some useful initial text",
"marks": [
{
"value": 0,
"label": "Transparent"
},
{
"value": 25,
"label": "Faint"
},
{
"value": 50,
"label": "Light"
},
{
"value": 75,
"label": "Dark"
},
{
"value": 100,
"label": "Solid"
}
],
"step": 25
}
}
},
"labelledListWithDecimals": {
"title": "Decimal dropdown with labels",
"description": "A dropdown with user friendly labels",
"type": "number",
"oneOf": [
{
"title": "Low",
"const": 0.45
},
{
"title": "Medium",
"const": 0.75
},
{
"title": "High",
"const": 0.85
}
]
}
},
"propertyOrder": []
}

Divider example content form
Link copied!

The content form for the example schema is shown below. The divider property provides a heading for the properties underneath.

A divider providing a heading for the a group of properties