File Dropzone
Drag-and-drop file upload zone component.
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
| Name | Type | Default | Description |
|---|---|---|---|
| name | str | 'file' | file input name |
| label | str | '' | label text |
| accept | str | '' | accepted file types |
| multiple | bool | False | allow multiple files |
| max_size_mb | int | 10 | max file size in MB |
| custom_class | str | '' | — |
| **kwargs | — passed to `Component.__init__`: `id=` sets `component.id`, and any other keyword is kept as state | — | — |
Source & styles
| File | Path | Notes |
|---|---|---|
| module | djust.components.components.file_dropzone | Subclass it, or pass custom_class, to change how it renders. |
| css | djust_components/components.css | Defines 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. |