# Array

Represents JavaScript `array`.

### Dynamic array

```javascript
{
    "type": "array",
    "items": { ... }
}
```

### Fixed array

```javascript
{
    "type": "array",
    "items": [{ ... }, { ... }]
}
```

Prop can be defined as dynamic array

```
      {
           "type": "array",
           "items": {
              "type": "string"
           }
       }
```

*In this case above would be TS type string\[].*

... or as fixed

```
      {
           "type": "array",
           "items": [
                   {"type": "string" },  {"type": "number" }, {"type": "string" }
           ]
       }
```

*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.

```
{
        "type": "array",
        "key": "planets",
        "items": [  { "key": "planets[]" }   ]
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jsf.gitbook.io/jsf/schema/property-types/array.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
