Control widget opening and closing behavior
mainYou can intercept the opening and closing of the calendar and clock widgets using the following lifecycle props. These are useful for implementing custom logic (e.g., preventing closing when clicking specific elements).
shouldOpenWidgets: A function called before a widget opens. Receives{ reason: OpenReason, widget: 'calendar' | 'clock' }. Returnfalseto prevent opening.shouldCloseWidgets: A function called before a widget closes. Receives{ reason: CloseReason, widget: 'calendar' | 'clock' }. Returnfalseto prevent closing.onCalendarOpen/onCalendarClose: Callbacks triggered when the calendar opens or closes.onClockOpen/onClockClose: Callbacks triggered when the clock opens or closes.
Reasons for opening/closing include:
buttonClick(clicking the toggle button)escape(pressing the Escape key)outsideAction(clicking outside the picker)select(selecting a value)focus(focusing an input field)