Skip to main content

Date picker element

Fields

FieldTypeDescriptionRequired?
typeStringThe type of element. In this case type is always datepicker.Required
action_idStringAn 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_ids in the containing block. Maximum length is 255 characters.Optional
initial_dateStringThe initial date that is selected when the element is loaded. This should be in the format YYYY-MM-DD.Optional
confirmObjectA confirm object that defines an optional confirmation dialog that appears after a date is selected.Optional
focus_on_loadBooleanIndicates 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
placeholderObjectA 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

The date picker element must be used inside the section block, actions block, or input block. This example shows a section block containing a date picker element:

{
"blocks": [
{
"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"
}
}
}
]
}