Select menu element
We're still building and not all features are available quite yet. Enjoy this peek into the future!
Not ready for the future? Return to the past at api.slack.com.
Usage info
Interactive component - see our guide to enabling interactivity.
The select menu also includes type-ahead functionality, where a user can type a part or all of an option string to filter the list.
There are different types of select menu elements that depend on different data sources for their lists of options:
- Select menu of static options
- Select menu of external data source
- Select menu of users
- Select menu of conversations
- Select menu of public channels
Select menu of static options
This is the most basic form of select menu, with a static list of options passed in when defining the element.
Fields
Field | Type | Description | Required? |
---|---|---|---|
type | String | The type of element. In this case type is always static_select . | Required |
action_id | String | An identifier for the action triggered when a menu option is selected. You can use this when you receive an interaction payload to identify the source of the action. Should be unique among all other action_id s in the containing block. Maximum length is 255 characters. | Optional |
options | Object[] | An array of option objects. Maximum number of options is 100. If option_groups is specified, this field should not be. | Required |
option_groups | Object[] | An array of option group objects. Maximum number of option groups is 100. If options is specified, this field should not be. | Optional |
initial_option | Object | A single option that exactly matches one of the options within options or option_groups . This option will be selected when the menu initially loads. | Optional |
confirm | Object | A confirm object that defines an optional confirmation dialog that appears after a menu item is selected. | Optional |
focus_on_load | Boolean | Indicates whether the element will be set to auto focus within the view object . Only one element can be set to true . Defaults to false . | Optional |
placeholder | Object | A plain_text only text object that defines the placeholder text shown on the menu. Maximum length for the text in this field is 150 characters. | Optional |
Example
A static select menu
[
{
"type": "section",
"block_id": "section678",
"text": {
"type": "mrkdwn",
"text": "Pick an item from the dropdown list"
},
"accessory": {
"action_id": "text1234",
"type": "static_select",
"placeholder": {
"type": "plain_text",
"text": "Select an item"
},
"options": [
{
"text": {
"type": "plain_text",
"text": "*this is plain_text text*"
},
"value": "value-0"
},
{
"text": {
"type": "plain_text",
"text": "*this is plain_text text*"
},
"value": "value-1"
},
{
"text": {
"type": "plain_text",
"text": "*this is plain_text text*"
},
"value": "value-2"
}
]
}
}
]
Select menu of external data source
This select menu will load its options from an external data source, allowing for a dynamic list of options.
Setup
If you don't have Socket Mode enabled, you'll need to configure your app to use this menu type:
- Go to your app's settings page and select Interactivity & Shortcuts from the sidebar.
- Add a URL to the Options Load URL under Select Menus.
- Save changes.
Each time a select menu of this type is opened or the user starts typing in the typeahead field, we'll send a request to your specified URL. Your app should return an HTTP 200 OK response, along with an application/json
post body with an object containing either:
- an
options
array - an
option_groups
array
The options
array can have a maximum number of 100 options.
The option_groups
array can have a maximum number of 100 option groups, with each option group allowing up to 100 options.
Here's an example response:
{
"options": [
{
"text": {
"type": "plain_text",
"text": "*this is plain_text text*"
},
"value": "value-0"
},
{
"text": {
"type": "plain_text",
"text": "*this is plain_text text*"
},
"value": "value-1"
},
{
"text": {
"type": "plain_text",
"text": "*this is plain_text text*"
},
"value": "value-2"
}
]
}
Refer to options
and option_groups
for more information about their related fields.
Fields
Field | Type | Description | Required? |
---|---|---|---|
type | String | The type of element. In this case type is always external_select . | Required |
action_id | String | An identifier for the action triggered when a menu option is selected. You can use this when you receive an interaction payload to identify the source of the action. Should be unique among all other action_id s in the containing block. Maximum length is 255 characters. | Optional |
initial_option | Object | A single option that exactly matches one of the options within the options or option_groups loaded from the external data source. This option will be selected when the menu initially loads. | Optional |
min_query_length | Integer | When the typeahead field is used, a request will be sent on every character change. If you prefer fewer requests or more fully ideated queries, use the min_query_length attribute to tell Slack the fewest number of typed characters required before dispatch. The default value is 3 . | Optional |
confirm | Object | A confirm object that defines an optional confirmation dialog that appears after a menu item is selected. | Optional |
focus_on_load | Boolean | Indicates whether the element will be set to auto focus within the view object . Only one element can be set to true . Defaults to false . | Optional |
placeholder | Object | A plain_text only text object that defines the placeholder text shown on the menu. Maximum length for the text in this field is 150 characters. | Optional |
Example
A select menu in a section block with an external data source:
[
{
"type": "section",
"block_id": "section678",
"text": {
"type": "mrkdwn",
"text": "Pick an item from the dropdown list"
},
"accessory": {
"action_id": "text1234",
"type": "external_select",
"placeholder": {
"type": "plain_text",
"text": "Select an item"
},
"min_query_length": 3
}
}
]
Select menu of users
This select menu will populate its options with a list of Slack users visible to the current user in the active workspace.
Fields
Field | Type | Description | Required? |
---|---|---|---|
type | String | The type of element. In this case type is always users_select . | Required |
action_id | String | An identifier for the action triggered when a menu option is selected. You can use this when you receive an interaction payload to identify the source of the action. Should be unique among all other action_id s in the containing block. Maximum length is 255 characters. | Optional |
initial_user | String | The user ID of any valid user to be pre-selected when the menu loads. | Optional |
confirm | Object | A confirm object that defines an optional confirmation dialog that appears after a menu item is selected. | Optional |
focus_on_load | Boolean | Indicates whether the element will be set to auto focus within the view object . Only one element can be set to true . Defaults to false . | Optional |
placeholder | Object | A plain_text only text object that defines the placeholder text shown on the menu. Maximum length for the text in this field is 150 characters. | Optional |
Example
A select menu in a section block showing a list of users:
[
{
"type": "section",
"block_id": "section678",
"text": {
"type": "mrkdwn",
"text": "Pick a user from the dropdown list"
},
"accessory": {
"action_id": "text1234",
"type": "users_select",
"placeholder": {
"type": "plain_text",
"text": "Select an item"
}
}
}
]
Select menu of conversations
This select menu will populate its options with a list of public and private channels, DMs, and MPIMs visible to the current user in the active workspace.
Fields
Field | Type | Description | Required? |
---|---|---|---|
type | String | The type of element. In this case type is always conversations_select . | Required |
action_id | String | An identifier for the action triggered when a menu option is selected. You can use this when you receive an interaction payload to identify the source of the action. Should be unique among all other action_id s in the containing block. Maximum length is 255 characters. | Optional |
initial_conversation | String | The ID of any valid conversation to be pre-selected when the menu loads. If default_to_current_conversation is also supplied, initial_conversation will take precedence. | Optional |
default_to_current_conversation | Boolean | Pre-populates the select menu with the conversation that the user was viewing when they opened the modal, if available. Default is false . | Optional |
confirm | Object | A confirm object that defines an optional confirmation dialog that appears after a menu item is selected. | Optional |
response_url_enabled | Boolean | This field only works with menus in input blocks in modals. When set to true , the view_submission payload from the menu's parent view will contain a response_url . This response_url can be used for message responses. The target conversation for the message will be determined by the value of this select menu. | Optional |
filter | Object | A filter object that reduces the list of available conversations using the specified criteria. | Optional |
focus_on_load | Boolean | Indicates whether the element will be set to auto focus within the view object . Only one element can be set to true . Defaults to false . | Optional |
placeholder | Object | A plain_text only text object that defines the placeholder text shown on the menu. Maximum length for the text in this field is 150 characters. | Optional |
Example
A select menu in a section block showing a list of conversations:
[
{
"type": "section",
"block_id": "section678",
"text": {
"type": "mrkdwn",
"text": "Pick a conversation from the dropdown list"
},
"accessory": {
"action_id": "text1234",
"type": "conversations_select",
"placeholder": {
"type": "plain_text",
"text": "Select an item"
}
}
}
]
Select menu of public channels
This select menu will populate its options with a list of public channels visible to the current user in the active workspace.
Fields
Field | Type | Description | Required? |
---|---|---|---|
type | String | The type of element. In this case type is always channels_select . | Required |
action_id | String | An identifier for the action triggered when a menu option is selected. You can use this when you receive an interaction payload to identify the source of the action. Should be unique among all other action_id s in the containing block. Maximum length is 255 characters. | Optional |
initial_channel | String | The ID of any valid public channel to be pre-selected when the menu loads. | Optional |
confirm | Object | A confirm object that defines an optional confirmation dialog that appears after a menu item is selected. | Optional |
response_url_enabled | Boolean | This field only works with menus in input blocks in modals. When set to true , the view_submission payload from the menu's parent view will contain a response_url . This response_url can be used for message responses. The target channel for the message will be determined by the value of this select menu. | Optional |
focus_on_load | Boolean | Indicates whether the element will be set to auto focus within the view object . Only one element can be set to true . Defaults to false . | Optional |
placeholder | Object | A plain_text only text object that defines the placeholder text shown on the menu. Maximum length for the text in this field is 150 characters. | Optional |
Example
A select menu in a section block showing a list of channels:
[
{
"type": "section",
"block_id": "section678",
"text": {
"type": "mrkdwn",
"text": "Pick a channel from the dropdown list"
},
"accessory": {
"action_id": "text1234",
"type": "channels_select",
"placeholder": {
"type": "plain_text",
"text": "Select an item"
}
}
}
]