app/pb_kits/playbook/pb_date_picker/docs/_date_picker_turbo_frames_rails
The custom_event_type
prop allows you to specify a custom event that will trigger the date picker’s initialization, in addition to the default initialization on DOMContentLoaded
. This is particularly useful in dynamic contexts like Turbo Frame updates where you need to reinitialize the date picker after new content loads. For Turbo integration, use custom_event_type: "turbo:before-render"
to ensure the date picker properly reinitializes after Turbo navigation events.
In this example, we demonstrate the setup pattern by connecting a button to dispatch a “datePickerLoader” event - while the date picker’s event listener is properly configured through the custom_event_type
prop, this demo only logs the event dispatch to the console to illustrate the connection structure.