← Back to Components
File Input
Styled file uploads backed by Shiny's native upload binding.
Interactive Playground
R Code
API Reference
block_file_input()
Renders a styled file picker while preserving Shiny's native file upload data frame.
| Argument | Type | Default | Description |
|---|---|---|---|
| input_id | character | required | Input identifier returned as input$<id>. |
| variant | 'button' | 'dropzone' | 'button' | Picker variant: styled button or drag-and-drop surface. |
| multiple | logical | FALSE | Allow selecting multiple files. |
| accept | character | NULL | Accepted MIME types or file extensions. |
| button_label | character | "Browse" | Text shown inside the visible picker button. |
| placeholder | character | "No file selected" | Text shown before files are selected. |
| dropzone_label | character | "Drag files here or click to browse" | Primary dropzone text (dropzone variant only). |
| dropzone_hint | character | NULL | Secondary dropzone hint text (dropzone variant only). |
| dropzone_icon | character | tag | NULL | Icon above the dropzone label: icon name or htmltools tag (dropzone variant only). |
| dropzone_content | tag | tagList | NULL | Custom dropzone interior; replaces the icon/label/hint stack. Mark the picker trigger with data-dropzone-trigger (dropzone variant only). |
| width | character | NULL | CSS width applied to the wrapper. |
| disabled | logical | FALSE | Disable the visible picker and native file input. |
| invalid | logical | FALSE | Apply invalid visual highlights. |
| style | character | object | NULL | Inline styles applied to the visible control. |
| class | character | NULL | Additional class applied to the visible control. |
update_block_file_input()
Updates picker labels and states from server handlers, or clears the current selection.
| Argument | Type | Default | Description |
|---|---|---|---|
| session | ShinySession | required | Active Shiny session object. |
| input_id | character | required | Target file input component ID. |
| variant | 'button' | 'dropzone' | NULL | Switch the picker variant. |
| button_label | character | NULL | Replace the visible picker button text. |
| placeholder | character | NULL | Replace the empty-state placeholder text. |
| dropzone_label | character | NULL | Replace the dropzone primary text. |
| dropzone_hint | character | NULL | Replace the dropzone hint text. |
| dropzone_icon | character | tag | NULL | Replace the dropzone icon (name or tag); NULL clears it. |
| dropzone_content | tag | tagList | NULL | Replace the custom dropzone interior; NULL restores the default stack. |
| accept | character | NULL | Replace accepted MIME types or extensions. |
| multiple | logical | NULL | Toggle multi-file selection. |
| disabled | logical | NULL | Disable or re-enable the picker. |
| invalid | logical | NULL | Toggle invalid visual highlights. |
| style | character | object | NULL | Replace inline styles on the visible control. |
| class | character | NULL | Replace classes on the visible control. |
| reset | logical | FALSE | Clear the current file selection (the value itself cannot be set from the server). |