Resizable Panel

Container with a drag-to-resize handle.

python 9 params

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

NameTypeDefaultDescription
contentstr''HTML content inside the panel
directionstr'horizontal'"horizontal" or "vertical" (default "horizontal")
min_sizestr'100px'minimum size CSS value (default "100px")
max_sizestr'none'maximum size CSS value (default "none")
initial_sizestr'50%'starting size CSS value (default "50%")
disabledboolFalsedisable resize (default False)
custom_classstr''additional CSS classes
resize_eventstr — 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
FilePathNotes
moduledjust.components.components.resizable_panelSubclass it, or pass custom_class, to change how it renders.
cssdjust_components/components.cssDefines 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.