Time Picker
Style-agnostic time picker component using CSS custom properties.
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
| Name | Type | Default | Description |
|---|---|---|---|
| name | str | 'time' | Form field name |
| value | str | '' | Initial time value in HH:MM format |
| event | str — renames the event | '' | djust event handler name (for dj-change) |
| format_24h | bool | False | Use 24-hour format (default: False) |
| min_time | str | '' | Minimum selectable time (HH:MM) |
| max_time | str | '' | Maximum selectable time (HH:MM) |
| step | int | 1 | Minute step interval (default: 1) |
| disabled | bool | False | Whether the picker is disabled |
| label | str | '' | Optional label text |
| custom_class | str | '' | Additional CSS classes |
| **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.time_picker | Subclass it, or pass custom_class, to change how it renders. |
| css | djust_components/components.css | Defines 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. |