diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md
index 2e7595ed..f1929740 100644
--- a/COMPONENT_INDEX.md
+++ b/COMPONENT_INDEX.md
@@ -1263,7 +1263,7 @@ None.
| Prop name | Kind | Reactive | Type | Default value | Description |
| :--------------- | :----------------- | :------- | :----------------------------------------------------------------------------------------- | --------------------------------------- | ----------------------------------------------------------- |
-| files | let
| Yes | File[]
| []
| Obtain the uploaded file names |
+| files | let
| Yes | File[]
| []
| Obtain a reference to the uploaded files |
| status | let
| No | "uploading" | "edit" | "complete"
| "uploading"
| Specify the file uploader status |
| accept | let
| No | string[]
| []
| Specify the accepted file types |
| multiple | let
| No | boolean
| false
| Set to `true` to allow multiple files |
@@ -1300,6 +1300,7 @@ None.
| :------------------ | :--------------- | :------- | :----------------------------------------------------------------------------------------- | ------------------------------------------------ | -------------------------------------------- |
| ref | let
| Yes | null | HTMLInputElement
| null
| Obtain a reference to the input HTML element |
| labelText | let
| Yes | string
| "Add file"
| Specify the label text |
+| files | let
| Yes | File[]
| []
| Obtain a reference to the uploaded files |
| accept | let
| No | string[]
| []
| Specify the accepted file types |
| multiple | let
| No | boolean
| false
| Set to `true` to allow multiple files |
| disabled | let
| No | boolean
| false
| Set to `true` to disable the input |
diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json
index 7e30bf03..b744a5ed 100644
--- a/docs/src/COMPONENT_API.json
+++ b/docs/src/COMPONENT_API.json
@@ -3481,7 +3481,7 @@
{
"name": "files",
"kind": "let",
- "description": "Obtain the uploaded file names",
+ "description": "Obtain a reference to the uploaded files",
"type": "File[]",
"value": "[]",
"isFunction": false,
@@ -3607,6 +3607,17 @@
"constant": false,
"reactive": false
},
+ {
+ "name": "files",
+ "kind": "let",
+ "description": "Obtain a reference to the uploaded files",
+ "type": "File[]",
+ "value": "[]",
+ "isFunction": false,
+ "isFunctionDeclaration": false,
+ "constant": false,
+ "reactive": true
+ },
{
"name": "multiple",
"kind": "let",
diff --git a/src/FileUploader/FileUploader.svelte b/src/FileUploader/FileUploader.svelte
index fcb9c98a..05930c09 100644
--- a/src/FileUploader/FileUploader.svelte
+++ b/src/FileUploader/FileUploader.svelte
@@ -18,7 +18,7 @@
export let accept = [];
/**
- * Obtain the uploaded file names
+ * Obtain a reference to the uploaded files
* @type {File[]}
*/
export let files = [];
diff --git a/src/FileUploader/FileUploaderButton.svelte b/src/FileUploader/FileUploaderButton.svelte
index 7bc932e9..789ebb7f 100644
--- a/src/FileUploader/FileUploaderButton.svelte
+++ b/src/FileUploader/FileUploaderButton.svelte
@@ -9,6 +9,12 @@
*/
export let accept = [];
+ /**
+ * Obtain a reference to the uploaded files
+ * @type {File[]}
+ */
+ export let files = [];
+
/** Set to `true` to allow multiple files */
export let multiple = false;
@@ -45,6 +51,13 @@
import { createEventDispatcher } from "svelte";
const dispatch = createEventDispatcher();
+
+ let initialLabelText = labelText;
+
+ $: if (ref && files.length === 0) {
+ labelText = initialLabelText;
+ ref.value = null;
+ }