DatetimePicker#
Download this notebook from GitHub (right-click to download).
import datetime as dt
import panel as pn
import panel_material_ui as pmui
pn.extension()
The DatetimePicker
widget allows selecting selecting a datetime value using a text box and the browser’s datetime-picking utility.
Discover more on using widgets to add interactivity to your applications in the how-to guides on interactivity. Alternatively, learn how to set up callbacks and (JS-)links between parameters or how to use them as part of declarative UIs with Param.
Parameters:#
For details on other options for customizing the component see the customization guides.
Core#
disabled
(boolean): Whether the widget is editabledisabled_dates
(list): Dates to make unavailable for selection; others will be availableenabled_dates
(list): Dates to make available for selection; others will be unavailableenable_time
(boolean): Enable editing of the time in the widget, default is Trueenable_seconds
(boolean): Enable editing of seconds in the widget, default is Trueend
(date or datetime): Inclusive upper bound of the allowed date selection.military_time
(boolean): Enable 24 hours time in the widget, default is Truestart
(date or datetime): Inclusive lower bound of the allowed date selection.value
(datetime): The selected value as a datetime type
Display#
label
(str): The title of the widgetvisible
(boolean): Whether the widget is visible
Styling#
sx
(dict): Component level styling API.theme_config
(dict): Theming API.
Aliases#
For compatibility with Panel certain parameters are allowed as aliases:
button_style
: Alias forvariant
button_type
: Alias forcolor
name
: Alias forlabel
DatetimePicker
uses a browser-dependent calendar widget to select the datetime:
datetime_picker = pmui.DatetimePicker(
name='Datetime Picker', value=dt.datetime(2021, 3, 2, 12, 10)
)
pn.Column(datetime_picker, height=450)
To ensure it is visible in a notebook we have placed it in a Column
with a fixed height.
DatetimePicker.value
returns a datetime type that can be read out or set like other widgets:
datetime_picker.value
Controls#
The DatetimePicker
widget exposes a number of options which can be changed from both Python and Javascript. Try out the effect of these parameters interactively:
pn.Row(datetime_picker.controls(jslink=True), datetime_picker)
Download this notebook from GitHub (right-click to download).