Skip to main content

Upload

Ant Design

The Upload component is Ant Design's file picker. Users drop or select files, such as a CSV to import or a receipt to attach, and a query reads their contents to send them on.

Properties​

Property
Description
Expected Value
LabelText shown above the field, or beside it when Layout is horizontal.Text. Default: Attachment
ExtraHelp text shown under the field. A validation message replaces it while the value is not valid.Text
TooltipText shown from an info icon after the label.Text
LayoutWhere the label sits: vertical puts it above the field, horizontal puts it to the left.vertical, horizontal. Default: vertical
Typedrag shows a drop area that fills the component; select shows a button that opens the file browser.Drag area, Button. Default: Drag area
TextMain text in the drop area, or the label of the button.Text. Default: Click or drag a file to this area
HintSmaller text under the main text in the drop area.Text
AcceptFile types the picker offers, as extensions or types such as .csv,.xlsx or image/*. Leave it empty to accept any file.Text
MultipleLets the user pick several files at once.On or off. Default: Off
Max countMost files the component holds. Extra files are turned away with a message, and with 1 a new file replaces the old one. 0 sets no limit.Number. Default: 0
List typeHow picked files are listed. picture adds a thumbnail for images.text, picture. Default: text

Additional Actions​

Each of these can be switched on or off, or set with a logical expression by clicking fx.

Property
Description
Expected Value
VisibilityShows or hides the component. Hidden components keep their space unless Collapse when hidden is on.On or off. Default: On
Collapse when hiddenRemoves the hidden component's space, so the components below it move up.On or off. Default: Off
Loading stateShows the component's loading look and blocks interaction, for example while a query runs.On or off. Default: Off
DisableStops the user from interacting with the component.On or off. Default: Off

Devices​

Property
Description
Expected Value
Show on desktopShows the component in the desktop layout.On or off. Default: On
Show on mobileShows the component in the mobile layout.On or off. Default: Off

Events​

Add a handler from the Events section of the properties panel. See Event Triggers for the steps.

Event
Description
On changeTriggers when files are added, removed or cleared.
On removeTriggers when the user removes a file from the list.

Component Specific Actions (CSA)​

Run these from an event handler with Control Component, or from a RunJS query. See Component Specific Actions.

Action
Description
How To Access
Reset fieldRemoves all files.components.upload1.resetFields()
Clear filesRemoves all files.components.upload1.clearFiles()
Set visibilityShows the component when true, hides it when false.components.upload1.setVisibility(false)
Set disableDisables the component when true, enables it when false.components.upload1.setDisable(false)
Set loadingTurns the loading state on with true, off with false.components.upload1.setLoading(false)

Exposed Variables​

Variable
Description
How To Access
labelText shown above the field, or beside it when Layout is horizontal.{{components.upload1.label}}
extraHelp text shown under the field. A validation message replaces it while the value is not valid.{{components.upload1.extra}}
tooltipText shown from an info icon after the label.{{components.upload1.tooltip}}
layoutWhere the label sits: vertical puts it above the field, horizontal puts it to the left.{{components.upload1.layout}}
typedrag shows a drop area that fills the component; select shows a button that opens the file browser.{{components.upload1.type}}
textMain text in the drop area, or the label of the button.{{components.upload1.text}}
hintSmaller text under the main text in the drop area.{{components.upload1.hint}}
acceptFile types the picker offers, as extensions or types such as .csv,.xlsx or image/*. Leave it empty to accept any file.{{components.upload1.accept}}
multipleLets the user pick several files at once.{{components.upload1.multiple}}
maxCountMost files the component holds. Extra files are turned away with a message, and with 1 a new file replaces the old one. 0 sets no limit.{{components.upload1.maxCount}}
listTypeHow picked files are listed. picture adds a thumbnail for images.{{components.upload1.listType}}
fileListThe picked files, each as { uid, name, size, type, base64, content }. base64 holds the file's data, and content holds the text of text, CSV, JSON and XML files under 2 MB.{{components.upload1.fileList}}
valueThe same files as fileList. A Form reads this key.{{components.upload1.value}}
isVisibleWhether the component is visible.{{components.upload1.isVisible}}
isLoadingWhether the component is in its loading state.{{components.upload1.isLoading}}
isDisabledWhether the component is disabled.{{components.upload1.isDisabled}}

Styles​

Style
Default
Primary colorTheme: Brand primary
Text colorTheme: Primary text
Container backgroundTheme: Surface 1
Border colorTheme: Default border
Border radius—
Box shadow0px 0px 0px 0px #00000040

A default that starts with Theme: follows the app's theme until the style is set to another value. See App Themes.