Date picker element
Welcome to the new home of Slack developer docs!
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.
Example:
Fields
Field | Type | Description | Required? |
---|---|---|---|
type | String | The type of element. In this case type is always datepicker . | 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_date | String | The initial date that is selected when the element is loaded. This should be in the format YYYY-MM-DD . | Optional |
confirm | Object | A confirm object that defines an optional confirmation dialog that appears after a date 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 datepicker. Maximum length for the text in this field is 150 characters. | Optional |
Example
A section block containing a datepicker element:
{
"type": "section",
"block_id": "section1234",
"text": {
"type": "mrkdwn",
"text": "Pick a date for the deadline."
},
"accessory": {
"type": "datepicker",
"action_id": "datepicker123",
"initial_date": "1990-04-28",
"placeholder": {
"type": "plain_text",
"text": "Select a date"
}
}
}