1.0.4 • Published 2 years ago

js-calendar-strip v1.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Install

$ npm install js-calendar-strip
# OR
$ yarn add js-calendar-strip

Usage

The js-calendar-strip package is a versatile calendar strip component designed for seamless integration into web applications. It offers a compact, intuitive display of dates with easily accessible navigation controls. Developers can effortlessly generate and customize date ranges, making it an ideal solution for applications requiring date-based interactions.

Key Features:

  • Calendar Strip Display: Presents a visually intuitive strip of dates for easy reference.
  • Next and Previous Buttons: Allows users to navigate forward and backward to view different date ranges.
  • Customization Options: Offers a range of styling and design options for tailoring the calendar strip to suit specific application aesthetics.
  • Date Disabling: Provides the functionality to selectively disable specific dates, offering fine-grained control over user interactions.
import React, { useState } from 'react';
import JsCalendarStrip from 'js-calendar-strip';

const Example = () => {
  const [selectedDate, setSelectedDate] = useState(new Date());

  const handleSelectDate = date => {
    setSelectedDate(date);
  };

  return (
    <div>
      <JsCalendarStrip
        selectedDate={selectedDate}
        onDateChange={handleSelectDate}
      />
    </div>
  );
};

Props

PropDescriptionTypeDefault
selectedDateHolds the currently chosen date .Today's Date
onDateChangeCallback function triggered when a user selects a new date .Function
startDateSets the initial date from where the calendar needs to begin .Date
endDateFinal date visible in the calendar .Date
disableDatesAllows the inclusion of a list of dates that are not selectable within the calendar .Array
styleStyle for the main container of the calendar .
headerStyleStyle for the header text of the calendar .
dateNumberStyleStyle for the date number of the calendar strip .
dayNameStyleStyle for the day name of the calendar strip .
selectedDayNameStyleStyle for the selected day name of the calendar strip .
selectedDateNumberStyleStyle for the selected date number of the calendar strip .
selectedDateStyleStyle for the selected date of the calendar strip .
hoverStyleHover Style for the calendar strip .
disableStyleStyle for the disable date of the calendar strip .

License

Licensed under the MIT License.