# Collection

The Collection generator allows your users to create lists or grids of repeatable blocks of code, each with powerful UI tools for adding, removing, and sorting. These are useful for creating complex multi-element section types like testimonials, FAQs, etc.

```jsx
<Collection
  dataRef={content.links}
  tagName="div"
  minItems={3}
  item={(callout) => (
    <div>
      <RichText dataRef={callout.text} />
    </div>
  )}
/>
```

## Attributes

* **dataRef**: DataLocator - the data-element storing the Collection's configuration
* **item**: anonymous [arrow function](https://www.w3schools.com/js/js_arrow_function.asp) - used to create a collection item
* **tagName**: string (optional) - a hard-coded tag name for the rendered element
* **className**: string (optional) - a hard-coded class name to add to the rendered element
* **minItems**: number (optional) - the minumum # of items allowed in this collection (Default: 1)
* **maxItems**: number (optional) - the maximum # of items allowed in this collection (Default: 10)
* **defaultItems**: number (optional) - the starting # of items in this collection on creation
* **enableSorting**: boolean (optional) - when True, allows content authors to drag-and-drop resort items in this collection
* **enableControls**: boolean (optional) - when True, will display collection-specific controls in the editor UI


---

# 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://developer.unstack.com/docs/tags/collection.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.
