Array

An array of items of the same type

Specification

spec

  • Describes the data structure of array items.

  • Parameters inside spec use the syntax of the regular parameters.

Available types:

Type
Specification

object

The output is an array of primitive types. If the object contains a name, it will be ignored.

array

The output is a complex array of Objects.

{
	"name": "tags",
	"spec": {
		"type": "text",
		"label": "Tag"
	},
	"type": "array",
	"label": "Tags"
}

When no spec is provided, the array will behave as a primitive array of strings. However, the preferred approach is setting the spec to {"type": "text"}.

validate

  • Type: Object

  • Collection of validation directives.

Available parameters:

Parameter
Type
Specification

maxItems

number

Specifies the maximum length that an array parameter can have.

minItems

number

Specifies the minimum length that an array parameter can have.

enum

array

Array of allowed values in the array.

mode

  • Type: String

  • Allowed values are edit and choose.

When the array is editable , you can set the default state by using mode.

labels

Available parameters:

Parameter
Type
Specification

add

string

Default: Add item. The text is displayed on the adding button.

Examples

Primitive array

The primitive array is an array of simple variables, like numbers or strings.

Complex array

The complex array is an array of complex objects - collections.

Complex array with labeled collections

Amount of items

Use the validate object to set minItems and maxItems to control the minimum and/or maximum amount of items in the array.

Custom labels

Customize the button labels using the labels object.

Last updated