# Array option

Learn how to define list options for templates.

Array options accept a list of values, such as dependencies to install or components to import.

## Example

The following template greets a list of people:

**template.json5**

```json5
{
  "$schema": "https://schema.croct.com/json/v1/template.json",
  "title": "Greeting",
  "description": "Greets a list of people.",
  "options": {
    "names": {
      "type": "array",
      "description": "The names to greet.",
      "default": ["World"]
    }
  },
  "actions": [
    {
      "name": "print",
      "semantics": "info",
      "message": "Hello, ${options.names.join(', ')}!"
    }
  ]
}
```

You can pass the values as a JSON array:

```sh
croct use template.json5 --names '["Alice", "Bob"]'
```

This prints `Hello, Alice, Bob!`.

Array values support [expression](/reference/cli/templates/expressions) methods like `.length`, `.join()`, `.includes()`, and index access (`options.names[0]`).

## Properties

The following list describes the properties for array options:

- `type`: `string`

  The option type. Always `array` for array options.

- `description`: `string`

  A description displayed when prompting the user.

- `default`: `Array<any>` (optional)

  The default value used when the user does not provide one.

## Explore

- [Options overview](/reference/cli/templates/options/overview): Learn how template options work.
- [Repeat](/reference/cli/templates/actions/repeat): Learn how to iterate over array values.
