File input
A file picker for collecting uploads in a modal, up to a configurable file count and type list.
file_input lets someone attach one or more files to a form. It’s an input-block-only element,
and Slack restricts it further than most: it’s only supported in modals, not in messages or Home
tabs.
New entry
Fields
type"file_input"
Always `file_input`.
"file_input"action_id?string
Identifies this action in the interaction payload and as the key in `state.values`. Maximum length is 255 characters.
stringfiletypes?string[]
Accepted file extensions, without the dot (e.g. `["pdf", "png"]`). All file types are accepted when omitted.
string[]max_files?number
Maximum number of files that can be uploaded. Minimum 1, maximum 10.
number10Examples
Restricted to specific file types
The preview above limits uploads to pdf and png files via filetypes, and to 3 files via
max_files. The native file picker only offers matching files, but treat this as a convenience for
the person filling out the form. Validate the uploaded file types yourself when you handle the
submission.
Any file type, single upload
Without filetypes, any file is accepted. max_files: 1 still shows the same singular “Upload
File” button; Slack doesn’t change its label based on the limit.
Interactivity
Picking files calls onAction with the picked files’ metadata under files:
{
"type": "file_input",
"action_id": "files",
"block_id": "attachments",
"action_ts": "1706000000.000100",
"files": [{ "id": "F1706000000000", "name": "report.pdf", "filetype": "pdf", "size": 48213 }]
}
Reading the value
Picking files writes the same list to state.values as { type, files }:
{
"attachments": {
"files": {
"type": "file_input",
"files": [{ "id": "F1706000000000", "name": "report.pdf", "filetype": "pdf", "size": 48213 }]
}
}
}
Related
Rich text input
A formatted text field, also modal-only, that reports a rich_text value.
Text inputs
Plain text, email, URL and number inputs for modals and Home tabs.
Date picker
Pick a single date from a calendar dropdown.
Elements overview
Where each element can live, and how action_id and block_id fit together.