Components/Form/FilePicker
Interactive docs page: https://wix-pages.com/design-system-documentation/#/component/filepicker
The file picker allows users to upload a single file at a time. The component handles the file upload via the native file browser dialog, the validation and preview of an uploaded file.
<FileUpload/> instead.File upload consists of two labels: `mainLabel` for action text and `subLabel` for a description.
Define file types that could be uploaded with the `supportedFormats` prop. Separate formats with a comma.
Define the maximum file size for an upload with the `maxSize` prop.
Describe an error status by using the `errorMessage` prop. Messages will only be revealed when the `error` status is `true`.
Add text or any other component in an area above the component using the `header` prop.
| Name | Type | Default | Description |
|---|---|---|---|
dataHook | string | — | Applies a data-hook HTML attribute that can be used in tests. |
error | boolean | — | Defines if an error should show or not. |
errorMessage | string | '' | Sets an error message to display. |
header | ReactNode | — | Allows to insert overline text at the top left of a component. Can also be overridden with any other component, i.e. |
id | string | number | — | Specifies a unique id for the element. |
mainLabel | string | 'Choose File' | Sets the main action label. |
maxSize | number | 5000000 | Defines the maximum size of a file that can be uploaded. |
name | string | — | Defines a name for inner input. |
onChange | (file: File) => void | — | Defines a standard input onChange callback. |
subLabel | string | 'No file chosen (Max size 5 MB)' | Adds a supportive message below the action title. |
supportedFormats | string | '*' | Defines which file types to accept (i.e. .jpeg, .gif, .png). Formats should be separated by a comma. |
Import the driver matching your test environment:
| Method | Description |
|---|---|
hasError | Checks whether there's a visible error icon |
errorMessage | Gets error message text |
getSubLabel | Gets sub label text |
getMainLabel | Gets main label text |
getName | Gets FilePicker input name |
exists | Checks whether the component found with the given data hook. |
element | Gets the component root element. |
click | Clicks on the component root element. |
base | Returns UniDriver for the base element. |
Last updated: 22 October 2026