# Input block

Collects information from the reader with a label, one input element and an optional hint.

| | |
|---|---|
| **Type** | `input` |
| **Available in** | Modals, Home tab |
| **Compatible block elements** | [Checkboxes element](https://workstation.repzo.com/docs/developers/block-kit/elements/checkboxes-element), [Date picker element](https://workstation.repzo.com/docs/developers/block-kit/elements/date-picker-element), [Datetime picker element](https://workstation.repzo.com/docs/developers/block-kit/elements/datetime-picker-element), [Email input element](https://workstation.repzo.com/docs/developers/block-kit/elements/email-input-element), [File input element](https://workstation.repzo.com/docs/developers/block-kit/elements/file-input-element), [Multi-select menu element](https://workstation.repzo.com/docs/developers/block-kit/elements/multi-select-menu-element), [Number input element](https://workstation.repzo.com/docs/developers/block-kit/elements/number-input-element), [Plain-text input element](https://workstation.repzo.com/docs/developers/block-kit/elements/plain-text-input-element), [Radio button group element](https://workstation.repzo.com/docs/developers/block-kit/elements/radio-button-group-element), [Rich text input element](https://workstation.repzo.com/docs/developers/block-kit/elements/rich-text-input-element), [Select menu element](https://workstation.repzo.com/docs/developers/block-kit/elements/select-menu-element), [Time picker element](https://workstation.repzo.com/docs/developers/block-kit/elements/time-picker-element), [URL input element](https://workstation.repzo.com/docs/developers/block-kit/elements/url-input-element) |

## Fields

| Field | Type | Description | Required? |
|---|---|---|---|
| `type` | String | The type of block. For an input block, `type` is always `input`. | Required |
| `label` | [Text object](https://workstation.repzo.com/docs/developers/block-kit/objects/text-object) | A label shown above the element, as a `plain_text` text object. Maximum length for the `text` in this field is 2000 characters. | Required |
| `element` | Object | One of the compatible elements. | Required |
| `dispatch_action` | Boolean | When `true`, using the element sends a `block_actions` payload right away instead of waiting for the modal to be submitted. Can't be used with `file_input`. Defaults to `false`. | Optional |
| `block_id` | String | A unique identifier for the block. If not specified, one is generated. Use it to tell which block a `block_actions` payload came from. Maximum length is 255 characters. It must be unique within the message or view — a duplicate is replaced and reported as a warning. | Optional |
| `hint` | [Text object](https://workstation.repzo.com/docs/developers/block-kit/objects/text-object) | Lighter text shown below the element, as a `plain_text` text object. Maximum 2000 characters. | Optional |
| `optional` | Boolean | When `true`, the element may be empty when the reader submits. Defaults to `false`. | Optional |

> **How Repzo Chat differs from Slack**
>
> - Input blocks work in modals and the Home tab. In a message they show as a disabled stand-in and the API returns a warning (Slack allows them in messages).

## Examples

### A multi-line text input

This example belongs in a modal view — the screenshot shows it in a modal.

```json
{
  "blocks": [
    {
      "type": "input",
      "block_id": "reason",
      "label": {
        "type": "plain_text",
        "text": "Why does this deal need a discount?"
      },
      "element": {
        "type": "plain_text_input",
        "action_id": "reason_text",
        "multiline": true,
        "min_length": 20,
        "placeholder": {
          "type": "plain_text",
          "text": "Competitor offer, volume, contract length…"
        }
      },
      "hint": {
        "type": "plain_text",
        "text": "Managers see this when they review the request."
      }
    }
  ]
}
```

### An optional select menu

This example belongs in a modal view — the screenshot shows it in a modal.

```json
{
  "blocks": [
    {
      "type": "input",
      "block_id": "team",
      "optional": true,
      "label": {
        "type": "plain_text",
        "text": "Assign to team"
      },
      "element": {
        "type": "static_select",
        "action_id": "team_select",
        "placeholder": {
          "type": "plain_text",
          "text": "Choose a team"
        },
        "options": [
          {
            "text": {
              "type": "plain_text",
              "text": "Billing"
            },
            "value": "billing"
          },
          {
            "text": {
              "type": "plain_text",
              "text": "Technical support"
            },
            "value": "technical"
          },
          {
            "text": {
              "type": "plain_text",
              "text": "Onboarding"
            },
            "value": "onboarding"
          }
        ]
      }
    }
  ]
}
```

### A number input

This example belongs in a modal view — the screenshot shows it in a modal.

```json
{
  "blocks": [
    {
      "type": "input",
      "block_id": "quantity",
      "label": {
        "type": "plain_text",
        "text": "Quantity"
      },
      "element": {
        "type": "number_input",
        "action_id": "quantity_value",
        "is_decimal_allowed": false,
        "min_value": "1",
        "max_value": "500",
        "initial_value": "10"
      }
    }
  ]
}
```

## Related

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