Skip to main content

CalendarDatePicker

A Fluent calendar date picker: a button showing the selected date, which opens a calendar to pick another.

Example:

fluent.CalendarDatePicker(placeholder="Pick a date")
CalendarDatePicker
CalendarDatePicker

Inherits: LayoutControl

Properties

Events

  • on_change - Called when the user picks a date.

Example​

Fluent CalendarDatePicker​

Sourceplay_arrowTry Online
from datetime import date

import flet_fluent_ui as fluent

import flet as ft


def main(page: ft.Page):
page.title = "Fluent CalendarDatePicker"

def handle_change(e: ft.Event[fluent.CalendarDatePicker]):
# A picked date arrives in UTC: convert it to the local date.
day = e.control.value.astimezone()
status.value = f"Delivery on {day:%A, %B} {day.day}"

status = ft.Text("Delivery on Wednesday, May 14")

page.add(
ft.SafeArea(
content=ft.Column(
controls=[
fluent.CalendarDatePicker(
key="delivery",
value=date(2025, 5, 14),
first_date=date(2025, 5, 5),
# No deliveries on public holidays.
blackout_dates=[date(2025, 5, 26)],
on_change=handle_change,
),
status,
],
)
)
)


if __name__ == "__main__":
ft.run(main)
calendar_date_picker
Picking a day from the calendar

Properties​

blackout_datesclass-attributeinstance-attribute​

blackout_dates: list[DateTimeValue] = field(
    default_factory=list
)

Dates that can't be selected, such as holidays. They are shown struck through.

close_on_selectionclass-attributeinstance-attribute​

close_on_selection: bool = True

Whether the calendar closes when the user picks a date.

first_dateclass-attributeinstance-attribute​

first_date: DateTimeValue | None = None

The earliest date that can be selected. Earlier dates are shown greyed out.

first_day_of_weekclass-attributeinstance-attribute​

first_day_of_week: int | None = None

The day the weeks start on: 1 for Monday through 7 for Sunday.

If None, it depends on the locale.

highlight_todayclass-attributeinstance-attribute​

highlight_today: bool = True

Whether today's date is highlighted.

last_dateclass-attributeinstance-attribute​

last_date: DateTimeValue | None = None

The latest date that can be selected. Later dates are shown greyed out.

placeholderclass-attributeinstance-attribute​

placeholder: str | None = None

The text shown while no date is selected.

If None, a localized "Pick a date" is shown.

selection_colorclass-attributeinstance-attribute​

selection_color: ColorValue | None = None

The color of selected dates.

If None, the accent color of the theme is used.

valueclass-attributeinstance-attribute​

value: DateTimeValue | None = None

The selected date.

After the user picks a date, it holds a datetime in UTC for midnight local time: use value.astimezone() to get the local date.

Events​

on_changeclass-attributeinstance-attribute​

on_change: (
    ControlEventHandler[CalendarDatePicker] | None
) = None

Called when the user picks a date.

value holds the new date.