Skip to main content
The UploadButton component creates a button that opens a file upload dialog when clicked.

Basic usage

Constructor

str
default:"'Upload a File'"
Button label text
Literal['single', 'multiple', 'directory']
default:"'single'"
Upload mode:
  • "single" - One file
  • "multiple" - Multiple files
  • "directory" - All files in directory
list[str] | None
default:"None"
Allowed file types (e.g., [".pdf"], ["image"], ["audio"])
Literal['filepath', 'binary']
default:"'filepath'"
Return format:
  • "filepath" - String path to file
  • "binary" - Bytes object
Literal['primary', 'secondary', 'stop']
default:"'secondary'"
Button style variant
Literal['sm', 'md', 'lg']
default:"'lg'"
Button size

Events

  • click - Triggered when button is clicked
  • upload - Triggered when file upload completes

Examples

Images only

Multiple files