Resizable Panel
Container with a drag-to-resize handle.
Preview
Drag the edge to resize.
Arguments
resizable_panel(content='<p>Drag the edge to resize.</p>')
Usage
views.py
python
from djust import LiveView
from djust.components import ResizablePanel
from django.utils.safestring import mark_safe
class MyView(LiveView):
template_name = "my_template.html"
def mount(self, request, **kwargs):
self.component = ResizablePanel(content=mark_safe('<p>Drag the edge to resize.</p>'))my_template.html
django
{{ component }}Needs its script on the page: <script src="{% static 'djust_components/resizable-panel.js' %}"></script>. djust ships it; without it the markup renders but does not update in the browser.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| content | str | '' | HTML content inside the panel |
| direction | str | 'horizontal' | "horizontal" or "vertical" (default "horizontal") |
| min_size | str | '100px' | minimum size CSS value (default "100px") |
| max_size | str | 'none' | maximum size CSS value (default "none") |
| initial_size | str | '50%' | starting size CSS value (default "50%") |
| disabled | bool | False | disable resize (default False) |
| custom_class | str | '' | additional CSS classes |
| resize_event | str — renames the event; identity is `name` | '' | djust event sent with ``{"size": px}`` when a resize ends (optional) |
| **kwargs | — passed to `Component.__init__`: `name=` identifies the instance in the events it sends, `id=` sets `component.id`, and any other keyword is kept as state | — | — |
Source & styles
| File | Path | Notes |
|---|---|---|
| module | djust.components.components.resizable_panel | 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 2027, 2028, 2030, 2031, 2035. Override those rules, or the custom properties they read, in a stylesheet loaded after it. |