Sheet

Sheet/drawer overlay component.

python 7 params

Preview

is_open

Filters

Status, owner and date range.

python
sheet(is_open=True, title='Filters', content='<p style="margin:0">Status, owner and date range.</p>', side='right')

Usage

views.py
python
from djust import LiveView
from djust.decorators import event_handler
from djust.components import Sheet
from django.utils.safestring import mark_safe


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

    def mount(self, request, **kwargs):
        self.component = Sheet(is_open=True, title='Filters', content=mark_safe('<p style="margin:0">Status, owner and date range.</p>'))

    @event_handler()
    def close_sheet(self, value=None, **kwargs):
        ...  # write to self.component; the re-render carries it
my_template.html
django
{{ component }}

Events this component sends to the view: close_sheet.

Parameters

NameTypeDefault
contentstr''
titlestr''
sidestr'right'
is_openboolFalse
close_eventstr — renames the event; identity is `name`'close_sheet'
custom_classstr''
**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.sheetSubclass it, or pass custom_class, to change how it renders.
cssdjust_components/components.cssDefines 7 of this component's classes at line 701, 703, 704, 710, 712, 713, 715. Override those rules, or the custom properties they read, in a stylesheet loaded after it.
cssdjust_theming/catalogue.cssDefines 1 of this component's classes at line 159. Override those rules, or the custom properties they read, in a stylesheet loaded after it.