1.0.5 • Published 1 year ago

react-simple-calender v1.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Logo

react-simple-calender

A simple calender component for React

Usage/Examples

import React, { useState } from 'react';
import Calender from 'react-simple-calender';

function App() {

  const [date, setDate] = useState(new Date());

  return (
    <div className="App">
      <Calender
        preselectedDates={[
          '2024-03-20',
          '2024-03-23'
        ]}
        disabledDates={[
          '2024-03-28',
          '2024-03-29',
          '2024-04-2'
        ]}
        multiselect={false}
        onChange={(params) => {setDate(params.date); console.log(JSON.stringify(params))}}
        titleFormat={'MMMM YYYY'}
        daysFormat={2}
      />
    </div>
  );
}

export default App;

Guide

  import Calender from 'react-simple-calender
Prop nameTypeDescription
calenderSizenumberOptional. This will determine the height and width of the Calender container, default value is 300.
selectablebooleanOptional. If you want the dates on the calender to be selectable, true by default
disabledDatesstring[]Optional. An array of dates to disable. Example '2024-05-07', '2024-05-08', etc
minDatestring[]Optional. Dates before this day will disabled by default
onChangeOnChangeEvent { date: Date, selectedDates: string[] }Optional. Dates before this day will disabled by default
preselectedDatesstring[]Optional. Dates before this day will disabled by default, Example '2024-05-07', '2024-05-08', etc
titleFormat'MMM YY', 'MMM YYY', 'MMMM YY', 'MMMM YYYY', 'MM YY';Optional. Prop to change title format
daysFormatnumberOptional. Prop to choose how many letters are shown for days i.e Sun or S
calenderStyleCalenderStyleOptional. Custom style for all calender components
renderHeader(props: HeaderProps) => voidOptional.Render a custom calender header
multiselectbooleanOptional. Enable multiple date selection
renderMonthView(props: MonthViewProps) => voidOptional. Render a custom view for Month list
renderYearView(props: YearViewProps) => voidOptional. Render a custom view for Year list
1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago