-
-
-
- {{ file.name }}
-
-
-
- {{ file_info[0].name }}
-
+
+
+
+
+
+
- {{ label }}
+
+
+
+
+
+ {{ file.name }}
+
+
+
+ {{ file_info[0].name }}
+
+
+
+ {{ label }}
+
+
@@ -21,7 +32,12 @@ module.exports = {
mounted() {
this.chunk_size = 2 * 1024 * 1024;
this.$refs.dropzone.addEventListener('dragover', event => {
- event.preventDefault();
+ this.$refs.dropIndicator.style.display = 'unset';
+ });
+ this.$refs.dropzone.addEventListener('dragleave', event => {
+ if (!event.relatedTarget || !this.$refs.dropzone.contains(event.relatedTarget)) {
+ this.$refs.dropIndicator.style.display = 'none';
+ }
});
this.$refs.dropzone.addEventListener('drop', async event => {
diff --git a/solara/website/pages/documentation/components/input/file_drop.py b/solara/website/pages/documentation/components/input/file_drop.py
index 68c6b06f4..aba10c800 100644
--- a/solara/website/pages/documentation/components/input/file_drop.py
+++ b/solara/website/pages/documentation/components/input/file_drop.py
@@ -74,3 +74,27 @@ def Page():
__doc__ += apidoc(solara.FileDrop.f) # type: ignore
__doc__ += "# FileDropMultiple"
__doc__ += apidoc(solara.FileDropMultiple.f) # type: ignore
+__doc__ += """# Customization Example
+
+```solara
+import solara
+
+@solara.component
+def CustomHoverIndicator():
+ style = {"height": "100%", "width": "100%", "align-items": "center", "border": "2px dashed limegreen", "opacity": "0.85"}
+ with solara.Row(justify="center", style=style):
+ solara.HTML(tag="h3", unsafe_innerHTML="Drop file here")
+ solara.SpinnerSolara()
+
+@solara.component
+def Page():
+ number_of_files = solara.use_reactive(1)
+
+ with solara.FileDropMultiple(file_hover_indicator=CustomHoverIndicator()):
+ with solara.Card("Upload your file(s) here"):
+ solara.InputInt("Number of files", value=number_of_files)
+ for i in range(number_of_files.value):
+ solara.InputText("File name")
+
+```
+"""