Skip to content

Props ​

Calendar and Datepicker share these props. DateInput is a Date or an AD 'YYYY-MM-DD' string (Latin or Devanagari digits), e.g. minDate='2026-01-01'. Strings are safe to pass from Server Components; onChange always gives you a PatroDate.

PropTypeDefaultDescription
calendar'AD' | 'BS''AD'Which calendar system to display.
mode'single' | 'range''single'Pick one day, or a start and an end. See Date ranges.
valueDateInput | null-Controlled selection. null = nothing selected.
defaultValueDateInput | null-Starting selection when uncontrolled. Omitted or null = nothing selected.
onChange(value: PatroDate | null) => void-Called when a day is picked.
showSecondaryDatebooleantrueShow the other calendar's date on each day.
locale'en' | 'ne'each calendar's ownLanguage for month and weekday names. By default AD is English and BS is Nepali.
numerals'latin' | 'devanagari'each calendar's ownDigits for every number. By default AD uses Latin and BS Devanagari digits.
weekStartsOn0–60First day of the week (0 = Sunday).
fixedWeeksbooleantrueAlways show 6 week rows so the calendar keeps one height.
numberOfMonthsnumber1Months side by side (wrapping on narrow screens), e.g. 2 for a stay. Other months' days are hidden so none repeats; arrow keys move across months.
weekendDaysnumber[][]Weekdays to colour as weekends (0 = Sunday), e.g. [6] for Saturday as Nepali calendars do. Colour: --patro-weekend.
dayClassName(date: PatroDate) => string | undefined-Extra class names for a day, e.g. ({ bs }) => holidays.has(bs) ? 'holiday' : undefined.
dayContent(date: PatroDate) => ReactNode-Extra content in a day's top-left corner, e.g. event dots. Visual only; pair it with dayLabel.
dayLabel(date: PatroDate) => string | undefined-Appended to a day's accessible name, e.g. ({ bs }) => holidays[bs].
onMonthChange({ start, end }: { start: PatroDate; end: PatroDate }) => void-Called when the displayed month changes.
defaultMonthDateInputtoday's monthMonth shown when nothing is selected, e.g. decades back for a date of birth.
monthDateInput-Controlled displayed month. Navigation only calls onMonthChange: onMonthChange={({ start }) => setMonth(start.date)}.
showTodayButtonbooleanfalseShow a "Today" button that jumps to and selects today.
presets{ label: string; value: Date | DateRange | (() => …) }[]-Quick picks under the grid, e.g. { label: 'Next 7 days', value: () => ({ start: new Date(), end: addDays(new Date(), 6) }) }. Date in single mode, DateRange in range mode; functions are read when the button renders and when it's clicked. Presets that break the bounds or range rules are disabled; the one matching the value is marked pressed.
todayDateInputvisitor's clockThe current date. See Server rendering.
labelsPartial<PatroLabels>display languageOverride accessible names and button text (previousMonth, nextMonth, today, chooseDate, clear, …). Defaults follow locale: English or Nepali.
autoFocusbooleanfalseFocus the day grid on mount. On Datepicker it focuses the input instead.
classNamestring-Added to the root element.
styleCSSProperties-Inline styles on the root, including --patro-* token overrides. On a Datepicker, the tokens also reach its calendar.
theme'light' | 'dark'-Sets data-theme on the component root. See Theming.
minDateDateInput-Earliest selectable day. Earlier days are disabled and navigation stops there.
maxDateDateInput-Latest selectable day.
isDateDisabled(date: PatroDate) => boolean-Disable individual days, e.g. ({ date }) => date.getDay() === 6 for Saturdays.

Range mode only ​

With mode='range', value/defaultValue are DateRange and onChange receives a PatroDateRange (see Types). These props only apply there:

PropTypeDefaultDescription
minDaysnumber-Fewest days a range can span, counting both ends.
maxDaysnumber-Most days a range can span, counting both ends.
excludeDisabledbooleanfalseRanges can't contain disabled days.

Picking an end that breaks one starts a new range there. See Date ranges.

Datepicker only ​

PropTypeDefaultDescription
labelstring-Text shown above the input, linked to it for screen readers.
placeholderstring'Select a date' / 'मिति छान्नुहोस्'Shown when there's no value. Range mode defaults to 'Select dates' / 'मितिहरू छान्नुहोस्', and editable to 'YYYY-MM-DD'.
formatValue(value: PatroDate) => string-Custom input text, e.g. ({ bs }) => bs.
editablebooleanfalseLet people type the date too, in the displayed calendar: 2083-07-12, 2083/7/12, Latin or Devanagari digits. Committed on Enter or when leaving the field; text that isn't an allowed date is marked invalid on Enter and reverts on leave. Clicking the text, ArrowDown or the calendar button opens the calendar. Single mode only; formatValue isn't used while editable.
clearablebooleanfalseShow a button that clears the value (onChange(null)).
disabledbooleanfalseCan't be focused or opened.
readOnlybooleanfalseFocusable, but can't be opened or changed.
invalidbooleanfalseError styling (--patro-danger) and aria-invalid.
closeOnSelectbooleantrueClose the popover after picking a day.
open / defaultOpenboolean- / falseControlled / initial popover state.
onOpenChange(open: boolean) => void-Called when the popover wants to open or close.
placement'bottom-start' | 'bottom-end' | 'top-start' | 'top-end' | 'bottom' | 'top''bottom-start'Popover position.
portalbooleanfalseRender the popover in document.body (escapes overflow: hidden). Inside a modal dialog use portalContainer instead: a modal blocks clicks and focus outside itself. Theme it with the theme prop; ancestor data-theme won't reach it.
portalContainerElement | null-Render the popover into this element, e.g. a modal dialog's content; turns portal on.
namestring-Submits the date with native forms.
valueFormat'ad' | 'bs''ad'Submitted format, 'YYYY-MM-DD'.
requiredbooleanfalseBlocks native form submission while empty.
id, autoFocus, aria-label, aria-labelledby, aria-describedby, data-*, onFocus, onBlurPassed to the input.
inputClassNamestring-Extra class names for the field, e.g. a form library's input class.
inputModestring-Mobile keyboard for the editable text input, e.g. 'numeric'.

ref points at the focusable field: the combobox element, or the text input when editable.

Released under the MIT License.