Reference: Defining view objects

There are view objects for two surfaces:

Non-standard characters (including characters with diacritics) within view objects are converted and sent in unicode format when you receive the view callback payloads.

Preserving input entry in views
Data entered or selected in input blocks can be preserved while updating views. The new view that you use with views.update should contain the same input blocks and elements with identical block_id and action_id values.

Modal view objects are used within the following Web API methods:

Field Type Description Required?
type String The type of view. Set to modal for modals. Yes
title Object 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. Yes
blocks Array An array of blocks that defines the content of the view. Max of 100 blocks. Yes
close Object A plain_text element that defines the text displayed in the close button at the bottom-right of the view. Max length of 24 characters. No
submit Object A 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. No
private_metadata String A string that will be sent to your app in view_submission and block_actions events. Max length of 3000 characters. No
callback_id String 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. No
clear_on_close Boolean When set to true, clicking on the close button will clear all views in a modal and close it. Defaults to false. No
notify_on_close Boolean Indicates whether Slack will send your request URL a view_closed event when a user clicks the close button. Defaults to false. No
external_id String A custom identifier that must be unique for all views on a per-team basis. No
submit_disabled Boolean When set to true, disables the submit button until the user has completed one or more inputs. This property is for configuration modals.
{
  "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"
}

Home tab views

The Home tab is available only for Slack apps, not workflow automations. Home tab view objects are used within the views.publish Web API method.

Home tab view object fields

Field Type Description Required?
type String The type of view. Set to home for Home tabs. Yes
blocks Array An array of blocks that defines the content of the view. Max of 100 blocks. Yes
private_metadata String A string that will be sent to your app in view_submission and block_actions events. Max length of 3000 characters. No
callback_id String 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. No
external_id String A custom identifier that must be unique for all views on a per-team basis. No

Home tab view example

{
   "type":"home",
   "blocks":[
      {
         "type":"section",
         "text":{
            "type":"mrkdwn",
            "text":"A stack of blocks for the 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
               }
            }
         ]
      }
   ]
}