Array
Represents JavaScript array
.
Dynamic array
Fixed array
Prop can be defined as dynamic array
In this case above would be TS type string[].
... or as fixed
In this case above would be TS type [string, number, string].
Options
uniqueItems
The value of this keyword MUST be a boolean. If this keyword has boolean value false, the instance validates successfully. If it has boolean value true, the instance validates successfully if all of its elements are unique. Omitting this keyword has the same behavior as a value of false.
minItems
The value of this keyword MUST be a non-negative integer. An array instance is valid against "minItems" if its size is greater than, or equal to, the value of this keyword. Omitting this keyword has the same behavior as a value of 0.
maxItems
The value of this keyword MUST be a non-negative integer. An array instance is valid against "maxItems" if its size is less than, or equal to, the value of this keyword.
Displaying in layout
How to loop
Crucial layout part in order to be able to loop over array items is LayoutPropArray. You specify `key` to the array prop. Anything inside `items` will automatically be repeated for each element in array prop.
Last updated
Was this helpful?