Skip to content
Block Kit for React
Esc
↑↓navigate↵open⌘Jpreview
On this page

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

Attachments

Fields

PropType
type"file_input"

Always `file_input`.

Type"file_input"
action_id?string

Identifies this action in the interaction payload and as the key in `state.values`. Maximum length is 255 characters.

Typestring
filetypes?string[]

Accepted file extensions, without the dot (e.g. `["pdf", "png"]`). All file types are accepted when omitted.

Typestring[]
max_files?number

Maximum number of files that can be uploaded. Minimum 1, maximum 10.

Typenumber
Default10

Examples

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

Your AppAPP
Resume

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 }]
    }
  }
}

Was this page helpful?