DatePicker widget in Supervsely is a user-friendly and customizable date input solution for Supervisely app developers. It features an intuitive interface that allows users to select a date from a calendar or enter one manually. The widget supports a wide range of date formats, making it suitable for use in diverse applications. With its flexible styling options, the DatePicker component can seamlessly integrate with apps and enhance the user experience.
Function signature
Copy date_picker = DatePicker (
value = None ,
placeholder = " Select date " ,
picker_type = " date " ,
size = None ,
readonly = False ,
disabled = False ,
editable = True ,
clearable = True ,
format = " yyyy-MM-dd " ,
first_day_of_week = 1 ,
widget_id = None ,
) Parameters
Type
Description
Union[int, str, list, tuple]
Default value to date picker
Date picker input help text
Literal["year", "month", "date", "datetime", "week", "datetimerange", "daterange"]
Literal["large", "small", "mini", None]
Specifies that a date picker input should be read-only
Allows to edit date picker input value text
Allows to delete value by clicking
Determine first day of the week
Determine value displaying format
Default value to date picker
type: Union[int, str, list, tuple]
default value: None
Date picker input help text
type: str
default value: Select date"
Date picker type
type: Literal["year", "month", "date", "datetime", "week", "datetimerange", "daterange"]
default value: "date"
Determine widget size
type: Literal["large", "small", "mini", None]
default value: None
Specifies that a date picker input should be read-only
type: bool
default value: False
Disable widget
type: bool
default value: False
Allows to edit date picker input value text
type: bool
default value: True
Allows to delete value by clicking
type: bool
default value: True
Determine value displaying format
type: str
default value: "yyyy-MM-dd"
first_day_of_week
Determine first day of the week
type: int
default value: 1
ID of the widget
type: str
default value: None
Methods and attributes
Attributes and Methods
Description
Get date picker datetime string value
set_value(value: Union[int, str, datetime])
set_range_values(values: Union[list, tuple])
Set date range picker values
Decorator function is handled when date picker value is changed value
Mini App Example
You can find this example in our Github repository:
supervisely-ecosystem/ui-widgets-demos/input/005_date_picker/src/main.pyarrow-up-right
Import libraries
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Create Button, Text widgets we will use in UI for demo
Create app layout
Prepare a layout for app using Card widget with the content parameter and place widget that we've just created in the Container widget.
Create app using layout
Create an app object with layout parameter.