Time Picker

Style-agnostic time picker component using CSS custom properties.

python 11 params

Preview

:
Arguments
time_picker(name='start', value='09:30', label='Start time')

Usage

views.py
python
from djust import LiveView
from djust.components import TimePicker


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

    def mount(self, request, **kwargs):
        self.component = TimePicker(name='start', value='09:30', label='Start time')
my_template.html
django
{{ component }}

Parameters

NameTypeDefaultDescription
namestr'time'Form field name
valuestr''Initial time value in HH:MM format
eventstr — renames the event''djust event handler name (for dj-change)
format_24hboolFalseUse 24-hour format (default: False)
min_timestr''Minimum selectable time (HH:MM)
max_timestr''Maximum selectable time (HH:MM)
stepint1Minute step interval (default: 1)
disabledboolFalseWhether the picker is disabled
labelstr''Optional label text
custom_classstr''Additional CSS classes
**kwargs— passed to `Component.__init__`: `id=` sets `component.id`, and any other keyword is kept as state——
Source & styles
FilePathNotes
moduledjust.components.components.time_pickerSubclass it, or pass custom_class, to change how it renders.
cssdjust_components/components.cssDefines 7 of this component's classes at line 1805, 1806, 1807, 1808, 1809. Override those rules, or the custom properties they read, in a stylesheet loaded after it.