Date Picker

Server-rendered calendar date picker component.

python 10 params

Preview

November 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

NameTypeDefaultDescription
namestr'date'form field name
labelstr''label text
selectedstr''selected date (YYYY-MM-DD)
yearint0display year
monthint0display month prev_event, next_event, select_event: dj-click events
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 523, 798, 799, 800, 802, 803, 804, 805, 806, 808. 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 1114. 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 438. Override those rules, or the custom properties they read, in a stylesheet loaded after it.