DatePicker combines a trigger button with a popover calendar. The button displays the selected date (or placeholder text when empty), and clicking it opens a calendar for selection. It’s the most user-friendly way to collect a single date.Documentation Index
Fetch the complete documentation index at: https://prefab.prefect.io/docs/llms.txt
Use this file to discover all available pages before exploring further.
Basic Usage
Reading the Value
Use.rx to get a reactive reference to the selected date. The value is an ISO date string once a date is picked, but starts as undefined when nothing is selected. Use .then() to handle both states — showing formatted text when a date exists, and fallback text otherwise:
Before a date is picked, the text shows “None yet”. Pick a date and it updates instantly — the .date("long") pipe formats an ISO string like "2026-04-02" into "April 2, 2026".
In a Form
DatePicker works naturally alongside other form controls. Each component’s value syncs to state automatically — use.rx to reference it elsewhere:
API Reference
DatePicker Parameters
Button text when no date is selected.
State key for the selected date (stored as an ISO string).
Action(s) triggered when the date changes.
Additional Tailwind CSS classes.
Protocol Reference
DatePicker