Skip to main content

Calendar

A Shadcn calendar for picking one day.

When the user picks a day, value is set to a datetime at midnight UTC of that day, so value.date() gives the picked date in any time zone. A date can be assigned as well.

Example:

shad.Calendar(value=date.today(), on_change=lambda e: print(e.control.value))
Calendar
Calendar

Inherits: LayoutControl

Properties

  • max_date - The latest day that can be picked.
  • min_date - The earliest day that can be picked.
  • number_of_months - How many months to show side by side.
  • show_outside_days - Whether to show the days of the previous and next months that fill the first and last weeks.
  • show_week_numbers - Whether to show the week number at the start of each week.
  • value - The selected day.

Events

  • on_change - Called when the user picks or clears a day.

Example​

Shadcn Calendar​

play_arrowTry Online
import datetime

import flet_shadcn_ui as shad

import flet as ft


def main(page: ft.Page):
page.title = "Shadcn Calendar"

def handle_change(e: ft.Event[shad.Calendar]):
value = e.control.value
selection.value = f"Selected: {value.date() if value else 'none'}"

selection = ft.Text("Selected: 2025-06-12")

page.add(
ft.SafeArea(
content=ft.Column(
controls=[
shad.Calendar(
value=datetime.date(2025, 6, 12),
on_change=handle_change,
),
selection,
],
)
)
)


if __name__ == "__main__":
ft.run(main)
calendar
Picking June 20

Properties​

max_dateclass-attributeinstance-attribute​

max_date: DateTimeValue | None = None

The latest day that can be picked.

Raises:

  • ValueError - If it is not greater than or equal to min_date, when min_date is set.

min_dateclass-attributeinstance-attribute​

min_date: DateTimeValue | None = None

The earliest day that can be picked.

Raises:

number_of_monthsclass-attributeinstance-attribute​

number_of_months: int = 1

How many months to show side by side.

Raises:

  • ValueError - If it is not strictly greater than 0.

show_outside_daysclass-attributeinstance-attribute​

show_outside_days: bool = True

Whether to show the days of the previous and next months that fill the first and last weeks.

show_week_numbersclass-attributeinstance-attribute​

show_week_numbers: bool = False

Whether to show the week number at the start of each week.

valueclass-attributeinstance-attribute​

value: DateTimeValue | None = None

The selected day.

If None, no day is selected.

Events​

on_changeclass-attributeinstance-attribute​

on_change: ControlEventHandler[Calendar] | None = None

Called when the user picks or clears a day.