Date¶
- class marimo.ui.date(start: dt.date | str | None = None, stop: dt.date | str | None = None, value: dt.date | str | None = None, *, label: str = '', on_change: Callable[[dt.date], None] | None = None, full_width: bool = False)¶
A date picker with an optional start and stop date.
Example.
# initialize the date picker at a given date date = mo.ui.date(value="2022-01-01")
# when value is omitted, date picker initializes with today's date date = mo.ui.date()
# create a date picker with bounds date = mo.ui.date( value="2022-06-01", start="2022-01-01", stop="2022-12-31", )
Or from a dataframe series:
date = mo.ui.date.from_series(df["column_name"])
Attributes.
value: a str (YYYY-MM-DD) ordatetime.dateobject of the chosen datestart: the start datestop: the stop date
Initialization Args.
start: minimum date selectable; if None, defaults to 01-01-0001stop: maximum date selectable; if None, defaults to 12-31-9999value: default dateif
NoneandstartandstopareNone, defaults to the current day;else if
Noneandstartis notNone, defaults tostart;else if
Noneandstopis notNone, defaults tostop
label: text label for the elementon_change: optional callback to run when this element’s value changesfull_width: whether the input should take up the full width of its container
Public methods
from_series(series, **kwargs)Create a date picker from a dataframe series.
Inherited from
UIElementform([label, bordered, loading, ...])Create a submittable form out of this
UIElement.send_message(message, buffers)Send a message to the element rendered on the frontend from the backend.
Inherited from
Htmlbatch(**elements)Convert an HTML object with templated text into a UI element.
center()Center an item.
right()Right-justify.
left()Left-justify.
callout([kind])Create a callout containing this HTML element.
style(style)Wrap an object in a styled container.
Public Data Attributes:
DATEFORMATstartstopInherited from
UIElementvalueThe element’s current value.
Inherited from
HtmltextA string of HTML representing this element.