Date Picker
Server-rendered calendar date picker component.
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 = valuemy_template.html
django
{{ component }}Events this component sends to the view: date_prev_month, date_next_month, date_select.
Parameters
| Name | Type | Default |
|---|---|---|
| name | str | 'date' |
| label | str | '' |
| selected | str | '' |
| year | int | 0 |
| month | int | 0 |
| 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 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. |
| css | djust_theming/components.css | Defines 1 of this component's classes at line 1045. 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 437. Override those rules, or the custom properties they read, in a stylesheet loaded after it. |