Calendar
Calendar renders a single month view with built-in month navigation,
reservation protection, and controlled or uncontrolled month state.
When to use it
Choose Calendar when the user is selecting dates inside a focused monthly
context:
- booking forms
- reservation detail pages
- side panels or modals
- pricing or availability widgets where the current month matters
Key props
selected: current selection arrayreserved: protected booking intervalsrange: wait for two dates before completing selectionmonthandyear: control the visible monthonMonthChangeandonYearChange: react to navigationdisabled: block specific days or the entire calendar
Basic calendar
A minimal monthly booking view with protected reservations and controlled selection.
Loading interactive preview...
import { useState } from "react";
import { Calendar } from "@demark-pro/react-booking-calendar";
import "@demark-pro/react-booking-calendar/dist/react-booking-calendar.css";
const reserved = [
{
startDate: new Date(2030, 4, 12, 14, 0),
endDate: new Date(2030, 4, 14, 10, 0),
},
{
startDate: new Date(2030, 4, 18, 14, 0),
endDate: new Date(2030, 4, 20, 10, 0),
},
];
export function BookingCalendar() {
const [selected, setSelected] = useState([null, null]);
return (
<Calendar
selected={selected}
reserved={reserved}
onChange={setSelected}
options={{ weekStartsOn: 1 }}
/>
);
}
Controlled month navigation
When you pass both month and year, the component becomes fully controlled
for navigation:
<Calendar
month={activeMonth}
year={activeYear}
onMonthChange={(nextMonth, nextYear) => {
setActiveMonth(nextMonth);
setActiveYear(nextYear);
}}
/>
If you pass neither, the calendar manages the active month internally.
Notes
initialDateonly matters when month and year are uncontrolledoptions.weekStartsOnlets you shift the first weekdayoptions.localelocalizes the built-in month, weekday, day, and aria labels while the calendar grid stays Gregorian- the component also accepts regular
divprops such asclassName