# Container block

Groups child blocks under a title, optionally collapsible, with a configurable width.

| | |
|---|---|
| **Type** | `container` |
| **Available in** | Messages, Modals, Home tab |

## Fields

| Field | Type | Description | Required? |
|---|---|---|---|
| `type` | String | The type of block. For a container block, `type` is always `container`. | Required |
| `title` | [Text object](https://workstation.repzo.com/docs/developers/block-kit/objects/text-object) | Title of the container, using `plain_text`. Maximum 150 characters. | Required if `rich_text_title` is missing |
| `rich_text_title` | [Rich text block](https://workstation.repzo.com/docs/developers/block-kit/blocks/rich-text-block) | The title as a `rich_text` block. Takes precedence over `title` when both are present. | Required if `title` is missing |
| `subtitle` | [Text object](https://workstation.repzo.com/docs/developers/block-kit/objects/text-object) | Subtitle, `plain_text` or `mrkdwn`. Maximum 150 characters. | Optional |
| `child_blocks` | Object[] | The blocks inside the container. Maximum 10 blocks. | Required |
| `block_id` | String | A unique identifier for the block. Maximum length is 255 characters. It must be unique within the message or view — a duplicate is replaced and reported as a warning. | Optional |
| `width` | String | One of `narrow`, `standard`, `wide` or `full`. `full` fills the available space. Defaults to `standard`. | Optional |
| `icon` | [Image element](https://workstation.repzo.com/docs/developers/block-kit/elements/image-element) | A small image shown next to the title. `image_url` is at most 3000 characters, `alt_text` at most 2000. | Optional |
| `is_collapsible` | Boolean | When `true`, readers can collapse the container to its title. Defaults to `false`. | Optional |
| `default_collapsed` | Boolean | When `true` and `is_collapsible` is `true`, the container starts collapsed. Defaults to `false`. | Optional |
| `has_header_divider` | Boolean | When `true`, a line separates the title from the content. Only applies when the container isn't collapsible. Defaults to `false`. | Optional |

> **How Repzo Chat differs from Slack**
>
> - Slack shows containers in messages and the Home tab. Repzo shows them in modals too.
> - Any block can be a child, not only the ones Slack lists.
> - `block_id`s inside a container share the message's id space, so they must be unique across the whole message.

## Examples

### A container with a header divider

```json
{
  "blocks": [
    {
      "type": "container",
      "title": {
        "type": "plain_text",
        "text": "Order SO-2041 — 3 lines on backorder"
      },
      "subtitle": {
        "type": "mrkdwn",
        "text": "Customer: *Gulf Retail Co.*"
      },
      "has_header_divider": true,
      "child_blocks": [
        {
          "type": "section",
          "text": {
            "type": "mrkdwn",
            "text": "*LT-1400* ProBook 14 × 10 — ships 24 Oct\n*PRN-80* Receipt printer × 10 — ships 28 Oct\n*CD-58* Cash drawer × 10 — ships 2 Nov"
          }
        },
        {
          "type": "actions",
          "elements": [
            {
              "type": "button",
              "action_id": "split_shipment",
              "text": {
                "type": "plain_text",
                "text": "Ship available items"
              },
              "style": "primary",
              "value": "SO-2041"
            },
            {
              "type": "button",
              "action_id": "notify_customer",
              "text": {
                "type": "plain_text",
                "text": "Notify customer"
              },
              "value": "SO-2041"
            }
          ]
        }
      ]
    }
  ]
}
```

### A collapsed container with a rich text title

```json
{
  "blocks": [
    {
      "type": "container",
      "width": "wide",
      "is_collapsible": true,
      "default_collapsed": true,
      "rich_text_title": {
        "type": "rich_text",
        "elements": [
          {
            "type": "rich_text_section",
            "elements": [
              {
                "type": "text",
                "text": "Audit details for ticket #4821"
              }
            ]
          }
        ]
      },
      "child_blocks": [
        {
          "type": "section",
          "fields": [
            {
              "type": "mrkdwn",
              "text": "*Opened*\n12 Oct, 09:14"
            },
            {
              "type": "mrkdwn",
              "text": "*First reply*\n12 Oct, 09:31"
            },
            {
              "type": "mrkdwn",
              "text": "*Reassigned*\n2 times"
            },
            {
              "type": "mrkdwn",
              "text": "*SLA*\nMet"
            }
          ]
        },
        {
          "type": "context",
          "elements": [
            {
              "type": "mrkdwn",
              "text": "Generated by the Helpdesk app"
            }
          ]
        }
      ]
    }
  ]
}
```

## Related

- [Blocks](https://workstation.repzo.com/docs/developers/block-kit/blocks)
- [Block Kit overview](https://workstation.repzo.com/docs/developers/block-kit)
