Date Picker

Server-rendered calendar date picker component.

python 10 params

Preview

September 2026
Mo
Tu
We
Th
Fr
Sa
Su

Usage

views.py
python
from djust import LiveView
from djust.decorators import event_handler
from djust.components import DatePicker


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

    def mount(self, request, **kwargs):
        self.component = DatePicker()

    @event_handler()
    def date_prev_month(self, **kwargs):
        self.component.month = (self.component.month - 2) % 12 + 1

    @event_handler()
    def date_next_month(self, **kwargs):
        self.component.month = self.component.month % 12 + 1

    @event_handler()
    def date_select(self, value, **kwargs):
        self.component.selected = value
my_template.html
django
{{ component }}

Events this component sends to the view: date_prev_month, date_next_month, date_select.

Parameters

NameTypeDefault
namestr'date'
labelstr''
selectedstr''
yearint0
monthint0
prev_eventstr — renames the event'date_prev_month'
next_eventstr — renames the event'date_next_month'
select_eventstr — renames the event'date_select'
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.date_pickerSubclass it, or pass custom_class, to change how it renders.
cssdjust_components/components.cssDefines 10 of this component's classes at line 500, 772, 773, 774, 776, 777, 778, 779, 780, 782. Override those rules, or the custom properties they read, in a stylesheet loaded after it.
cssdjust_theming/components.cssDefines 1 of this component's classes at line 1045. Override those rules, or the custom properties they read, in a stylesheet loaded after it.
cssdjust_theming/scaffold.cssDefines 1 of this component's classes at line 437. Override those rules, or the custom properties they read, in a stylesheet loaded after it.