Date Picker
The form side of dates: a grid for picking a single date, multiple dates, or a range, plus the composition pattern for date fields. For readonly month views that display data — heatmaps, event grids, mini calendars — see Calendar.
Examples
Single date
| Mo | Tu | We | Th | Fr | Sa | Su |
|---|---|---|---|---|---|---|
Range
| Mo | Tu | We | Th | Fr | Sa | Su |
|---|---|---|---|---|---|---|
| Mo | Tu | We | Th | Fr | Sa | Su |
|---|---|---|---|---|---|---|
Month and year dropdowns
| Mo | Tu | We | Th | Fr | Sa | Su |
|---|---|---|---|---|---|---|
Disabled dates
| Mo | Tu | We | Th | Fr | Sa | Su |
|---|---|---|---|---|---|---|
Date picker field
Overview
The picker grid is the Calendar component, which wraps react-day-picker v9 with Rogo styling. All DayPicker props pass through: selection modes, min/max dates, disabled matchers, multiple months, localization, and custom formatters.
import { Calendar } from "@rogo-technologies/ui/calendar";
const [date, setDate] = useState<Date | undefined>();
<Calendar mode="single" selected={date} onSelect={setDate} />;Usage
Selection modes
mode controls what selected / onSelect operate on: a Date (single), a Date[] (multiple), or a DateRange (range).
import { Calendar, type DateRange } from "@rogo-technologies/ui/calendar";
const [range, setRange] = useState<DateRange | undefined>();
<Calendar mode="range" selected={range} onSelect={setRange} numberOfMonths={2} />;Disabling dates
disabled accepts a Matcher or array of matchers — weekdays, ranges, predicates, or explicit dates.
<Calendar
mode="single"
selected={date}
onSelect={setDate}
disabled={[{ dayOfWeek: [0, 6] }, { before: new Date() }]}
/>Month and year dropdowns
captionLayout="dropdown" replaces the caption label with month and year selects. Bound the years with startMonth / endMonth.
<Calendar
mode="single"
captionLayout="dropdown"
startMonth={new Date(2000, 0)}
endMonth={new Date(2035, 11)}
selected={date}
onSelect={setDate}
/>Date picker field
There is intentionally no DatePicker component — compose Popover, Button, and Calendar.
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>
<Button variant="outline" prefix={<IconCalendar1 />}>
{date ? format(date, "PPP") : "Pick a date"}
</Button>
</PopoverTrigger>
<PopoverContent className="w-auto p-0" align="start">
<Calendar mode="single" selected={date} onSelect={selectDate} />
</PopoverContent>
</Popover>API
| Prop | Type | Default | Description |
|---|---|---|---|
mode | "single" | "multiple" | "range" | — | Selection behavior. |
selected | Date | Date[] | DateRange | — | Controlled selection (type follows mode). |
onSelect | (value) => void | — | Selection callback (type follows mode). |
numberOfMonths | number | 1 | Months rendered side by side. |
captionLayout | "label" | "dropdown" | "label" | Caption as text or month/year dropdowns. |
disabled | Matcher | Matcher[] | — | Dates that can't be selected. |
showOutsideDays | boolean | true | Render leading/trailing days of neighboring months. |
startMonth / endMonth | Date | — | Navigation bounds (also bound the year dropdown). |
All other react-day-picker props pass through unchanged.
Guidelines
Do
- Use
Calendarfor anything that picks dates — it ships keyboard navigation and ARIA grid semantics from react-day-picker - Compose date picker fields from
Popover+Button+Calendar - Bound the year dropdown with
startMonth/endMonthwhen usingcaptionLayout="dropdown"
Don't
- Don't rebuild date selection on top of
calendar-core— that's whatCalendaris for - Don't reach for
react-day-pickerdirectly in apps; import from@rogo-technologies/ui/calendarso styling stays consistent - Don't use a picker for readonly month views — build those on Calendar's
calendar-coreutilities