Date Picker
Server-rendered calendar date picker component.
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 = valuemy_template.html
django
{{ component }}Events this component sends to the view: date_prev_month, date_next_month, date_select.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| name | str | 'date' | form field name |
| label | str | '' | label text |
| selected | str | '' | selected date (YYYY-MM-DD) |
| year | int | 0 | display year |
| month | int | 0 | display month prev_event, next_event, select_event: dj-click events |
| prev_event | str — renames the event | 'date_prev_month' | — |
| next_event | str — renames the event | 'date_next_month' | — |
| select_event | str — renames the event | 'date_select' | — |
| custom_class | str | '' | — |
| **kwargs | — passed to `Component.__init__`: `id=` sets `component.id`, and any other keyword is kept as state | — | — |
Source & styles
| File | Path | Notes |
|---|---|---|
| module | djust.components.components.date_picker | Subclass it, or pass custom_class, to change how it renders. |
| css | djust_components/components.css | Defines 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. |
| css | djust_theming/components.css | Defines 1 of this component's classes at line 1114. Override those rules, or the custom properties they read, in a stylesheet loaded after it. |
| css | djust_theming/scaffold.css | Defines 1 of this component's classes at line 438. Override those rules, or the custom properties they read, in a stylesheet loaded after it. |