This Block Kit beta kicks of a series of improvments and new features to block kit, bringing some of the most requested feedback to you. This beta will include a number of additions to Block Kit that will roll out in a staggered manner over the next few weeks. This document will serve as your source of truth for this beta regarding dates for feature and how to use these new features. Our goal for this beta is to validate assumptions we’ve made while crafting these API changes and gather your input regarding the new functionality we’re bringing to Block Kit. Please provide feedback on these features using this link.
For use in: App Home
You can now utilize Input Blocks in your App Home. To utilize an input block in your app home, add the dispatch_action: true
flag to your input block definition to receive block actions from input blocks in app home. As there is no submit functionality in App Home, this will be the only way your app will receive the value of inputs in these blocks.
Sample App Home View:
{
"type": "home",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "Inputs in App Home!",
"emoji": true
}
},
{
"type": "input",
"dispatch_action": true,
"element": {
"type": "plain_text_input",
"dispatch_action_config": {
"trigger_actions_on": ["on_character_entered"]
}
},
"label": {
"type": "plain_text",
"text": "Label",
"emoji": true
}
}
]
}
For use in: Modals
Previously, when your app received a view_submission
payload, the state
value would only contain the state of any input blocks in the view. This meant that you were missing the state of any stateful elements in other interactive blocks from that view. Now, view_submission
and block_action
payloads will include a full state
property that will include all stateful elements, not just input blocks.
Below is a sample payload from a modal with a multi_conversations_select
element in a section block and a plain_text_input
element in an input block:
"state": {
"values": {
"section_block_id": {
"multi_convos": {
"type": "multi_conversations_select",
"selected_conversations": ["G12345"]
}
},
"input_block_id": {
"plain_text_action_id": {
"type": "plain_text_input",
"value": "test123"
}
}
}
}
For use in: Messages
Checkboxes and Radio buttons have previously been available for use in Modals and App Home. This feature allows you to use checkboxes and radio buttons in messages, as a part of section
and action
blocks. Messages are collaborative spaces in channels, allowing many users to interact with your app’s content simultaneously. Checkboxes and Radio buttons will allow you to create new UX experiences, such as collaborative lists and new types of polls.
To utilize checkboxes and radio buttons in messages, add either of these elements to section or action blocks.
Example Block Kit JSON:
{
"type":"actions",
"elements":[
{
"type":"checkboxes",
"options":[
{
"text":{
"type":"plain_text",
"text":"Option 1",
"emoji":true
},
"description":{
"type":"plain_text",
"text":"*this is plain_text text*",
"emoji":true
},
"value":"value-0"
}
]
}
]
}
API Specifications:
block_action
with the final state of the element.Disclaimers
For use in: Modals
Input Blocks are utilized in Modals, providing users with a surface area to input plain text input, select users, conversations, dates, etc. Historically, selections in an input block were provided to developers in the view_submission
payload. With this change, input blocks will behave in a similar manner to action blocks. For every user input and selection, a block_actions
payload will be fired with the contents of the input, allowing for realtime updates in a modal.
This feature is available for all input blocks. There is further configuration available for plain text input blocks, allowing you to customize when you would like to receive block_action
payloads.
In addition to this change, we have made the following improvements to Input Blocks:
optional
have a “clear” option. This should also dispatch an action.To receive block_actions
from input_blocks
add dispatch_actions = true
at the input block level. This flag will default to false in order to maintain backwards compatibility with previous input block behavior.
Example Payload:
{
type: "input",
dispatch_action: true,
element: {
type: "channels_select",
placeholder: {
type: "plain_text",
text: "Select channels",
emoji: true
}
},
label: {
type: "plain_text",
text: "Channels select in an input block dispatching actions",
emoji: true
}
}
With plain text elements, you are able to customize when you will receive block_actions
payloads, allowing you to tailor these interactions to your specific use cases. To customize, you will need to add a dispatch_action_config
object at the element level. This object is only functional in conjunction with the dispatch_actions
flag on input blocks on plain_text
elements. Providing a dispatch_action_config
without a dispatch_actions
will result in no actions being dispatched.
Dispatch Action Config Object:
Field | Type | Required? | Description |
---|---|---|---|
trigger_actions_on | String[] | yes | Indicates which user interactions you would like to receive block_actions for. You should provide an array of strings from the following options: on_enter_pressed , on_character_entered . The array cannot be empty. |
Note: If you are dispatching actions from a plain_text_input element in an input block on enter pressed, hint text will now appear underneath explaining to the user to press enter to submit on web and mobile.
Example Plain Text Input Block Schema:
{
type: "input",
dispatch_action: true,
element: {
type: "plain_text_input",
multiline: true,
dispatch_action_config: {
trigger_actions_on: ["on_character_entered"]
}
},
label: {
type: "plain_text",
text: "multiline Plain Text Input dispatch = true, on character typed",
emoji: true
}
}
Disclaimers/Known Bugs:
null
. This is a known inconsistency that will be fixed. Please be aware that the way empty states are represented may also change.initial_*
values on web only, and have some trouble updating them. This is a known bug and is being addressed.