1.2.5 • Published 10 months ago

rjs-booking-calendar v1.2.5

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

rjs-booking-calendar

A customizable booking calendar component for react

License

MIT License

Features

  • Installation
  • How to Use
  • Example
  • Props

Installation

  npm i rjs-booking-calendar --save

How to Use

import on the _app.js or layout.js

    import "rjs-booking-calendar/dist/index.css"

import the library on the page/component file

    import BookingCalendar from 'rjs-booking-calendar';

Example

Example image

Props

<BookingCalendar
  mode='week'
  slotData={slotList}
  onSlotSelect={handleSlotSelect}
  onMonthChange={handleMonthChange}
  disablePastDates={true}
  timeSlots={customTimeSlots}
  onClearAll={clearSlots}
  maxSelections={2}
/>
ParameterDescriptionDefault
modeSpecifies the display mode, either 'week' or 'month'.'month'
slotDataA list containing slot data.{}
onSlotSelectCallback function triggered upon slot selection.
onMonthChangeCallback function triggered when the month changes.
disablePastDatesDisables the selection of past dates.false
timeSlotsA complete list of time slots.Refer to timeSlots
onClearAllCallback function triggered when the "Clear All" button is clicked.
maxSelectionsMaximum number of slots that can be selected.Infinity
startYearThe starting year (default is 10 years before the current year).current year - 10
endYearThe ending year (default is 10 years after the current year).current year + 10
monthNamesAn array of month names.
weekdayNamesAn array of weekday names.
showClearButtonDetermines whether to display the clear button.true
startWeekOnThe day the week starts on (e.g., 'sunday').'sunday'
slotData = {
  '2024-9-25': [
    { time: '9:00 AM - 12:00 PM', status: 'booked' },
    { time: '5:00 PM - 9:00 PM', status: 'available' },
  ],
  '2024-9-26': [
    { time: '9:00 AM - 12:00 PM', status: 'reserved' },
    { time: '5:00 PM - 9:00 PM', status: 'available' },
  ],
};
const timeSlots = [
  '9:00 AM - 10:00 AM',
  '10:00 AM - 11:00 AM',
  '11:00 AM - 12:00 PM',
  '1:00 PM - 2:00 PM',
  '2:00 PM - 3:00 PM',
  '3:00 PM - 4:00 PM',
];
1.2.5

10 months ago

1.1.7

10 months ago

1.1.6

10 months ago

1.1.2

10 months ago

1.1.1

10 months ago

1.1.0

10 months ago

1.0.9

10 months ago

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago