@usevyre/react@usevyre/vue

Date Picker

An input trigger that opens a Calendarin a popover. Forwards all Calendar props and supports the samesingle / range / multiple modes. The popover closes automatically after selection. For an always-visible grid useCalendar; for start/end ranges with presets and a dual-month view useDateRangePicker.


Basic

Render a controlled DatePicker with value andonChange (or v-model in Vue). Set mode="range"for a start–end selection; the popover closes once both dates are picked.

import { useState } from "react";
import { DatePicker } from "@usevyre/react";

const [date, setDate] = useState<Date | null>(null);
const [range, setRange] = useState<[Date | null, Date | null]>([null, null]);

// Single
<DatePicker mode="single" value={date} onChange={setDate} placeholder="Pick a date" />

// Range
<DatePicker mode="range" value={range} onChange={setRange} placeholder="Pick a range" />

With time

Add showTime to include an HH:MM input in the popover. The time is stored in the same Date object as the selected day.

No date selected
<DatePicker value={date} onChange={setDate} showTime />

Props

Props

PropTypeDefaultDescription
mode"single" | "range" | "multiple""single"Selection mode. The value/onChange shape matches the mode.
value / v-modelDate | [Date|null, Date|null] | Date[]Controlled selected value. Type depends on mode.
onChange / @update:modelValue(v) => voidCalled when the selection changes.
placeholderstring"Pick a date"Text shown on the trigger when nothing is selected.
showTimebooleanfalseAdds an HH:MM time picker (single mode).
minDateDateDates before this are disabled.
maxDateDateDates after this are disabled.
disabled(date: Date) => booleanCustom callback to disable specific dates.
weekStartsOn0 | 11First day of the week. 0 = Sunday, 1 = Monday.
inputClass / inputClassNamestringAdditional CSS class on the trigger button.