File Dropzone

Drag-and-drop file upload zone component.

python 7 params

Preview

Drag files here or browse
Max 10 MB

Usage

views.py
python
from djust import LiveView
from djust.components import FileDropzone


class MyView(LiveView):
    template_name = "my_template.html"

    def mount(self, request, **kwargs):
        self.component = FileDropzone()
my_template.html
django
{{ component }}

Parameters

NameTypeDefaultDescription
namestr'file'file input name
labelstr''label text
acceptstr''accepted file types
multipleboolFalseallow multiple files
max_size_mbint10max file size in MB
custom_classstr''—
**kwargs— passed to `Component.__init__`: `id=` sets `component.id`, and any other keyword is kept as state——
Source & styles
FilePathNotes
moduledjust.components.components.file_dropzoneSubclass it, or pass custom_class, to change how it renders.
cssdjust_components/components.cssDefines 5 of this component's classes at line 813, 817, 820, 821, 823. Override those rules, or the custom properties they read, in a stylesheet loaded after it.