Reference: View payloads

Views are app-customized visual areas within modals and Home tabs.

To define these views, apps create view payloads — packages of information that describe layout, interactivity, and other useful metadata.

View payloads are used within the following Web API methods:

Modals:

Home tabs

Read the docs for each modals and Home tabs to understand how they incorporate views and use view payloads.

Below is a reference of all the possible fields within a view payload:

Fields

Field Type Required? Description
type String Yes The type of view. Set to modal for modals and home for Home tabs.

Used for Modals Home tabs
title Object Yes The title that appears in the top-left of the modal. Must be a plain_text text element with a max length of 24 characters.

Used for Modals
blocks Array Yes An array of blocks that defines the content of the view. Max of 100 blocks.

Used for Modals Home tabs
close Object No An optional plain_text element that defines the text displayed in the close button at the bottom-right of the view. Max length of 24 characters.

Used for Modals
submit Object No An optional plain_text element that defines the text displayed in the submit button at the bottom-right of the view. submit is required when an input block is within the blocks array. Max length of 24 characters.

Used for Modals
private_metadata String No An optional string that will be sent to your app in view_submission and block_actions events. Max length of 3000 characters.

Used for Modals Home tabs
callback_id String No An identifier to recognize interactions and submissions of this particular view. Don't use this to store sensitive information (use private_metadata instead). Max length of 255 characters.

Used for Modals Home tabs
clear_on_close Boolean No When set to true, clicking on the close button will clear all views in a modal and close it. Defaults to false.

Used for Modals
notify_on_close Boolean No Indicates whether Slack will send your request URL a view_closed event when a user clicks the close button. Defaults to false.

Used for Modals
external_id String No A custom identifier that must be unique for all views on a per-team basis.

Used for Modals Home tabs

Examples

A modal view:

{
  "type": "modal",
  "title": {
    "type": "plain_text",
    "text": "Modal title"
  },
  "blocks": [
    {
      "type": "section",
      "text": {
        "type": "mrkdwn",
        "text": "It's Block Kit...but _in a modal_"
      },
      "block_id": "section1",
      "accessory": {
        "type": "button",
        "text": {
          "type": "plain_text",
          "text": "Click me"
        },
        "action_id": "button_abc",
        "value": "Button value",
        "style": "danger"
      }
    },
    {
      "type": "input",
      "label": {
        "type": "plain_text",
        "text": "Input label"
      },
      "element": {
        "type": "plain_text_input",
        "action_id": "input1",
        "placeholder": {
          "type": "plain_text",
          "text": "Type in here"
        },
        "multiline": false
      },
      "optional": false
    }
  ],
  "close": {
    "type": "plain_text",
    "text": "Cancel"
  },
  "submit": {
    "type": "plain_text",
    "text": "Save"
  },
  "private_metadata": "Shhhhhhhh",
  "callback_id": "view_identifier_12"
}

A Home tab view:

{
   "type":"home",
   "blocks":[
      {
         "type":"section",
         "text":{
            "type":"mrkdwn",
            "text":"A simple stack of blocks for the simple sample Block Kit Home tab."
         }
      },
      {
         "type":"actions",
         "elements":[
            {
               "type":"button",
               "text":{
                  "type":"plain_text",
                  "text":"Action A",
                  "emoji":true
               }
            },
            {
               "type":"button",
               "text":{
                  "type":"plain_text",
                  "text":"Action B",
                  "emoji":true
               }
            }
         ]
      }
   ]
}