npm.io
1.0.2 • Published 5 years ago

react-barebones-calendar

Licence
MIT
Version
1.0.2
Deps
9
Size
174 kB
Vulns
0
Weekly
0
Stars
2

react-barebones-calendar

A simple fully customizable calendar for react.

react-barebones-calendar demo-gif

Getting Started

Installation

npm install --save react-barebones-calendar moment
Run Demo

To view the demos on a web page go to https://GeorgeVaughan.github.io/react-barebones-calendar

To run the demo on your computer:

Examples

View all the example code in src/examples/

The basic example is shown along with the code below:

react-barebones-calendar demo-png

class BasicCalendar extends Component<any, any> {
  constructor(props) {
    super(props);

    this.state = {
      monthMoments: getMonthsFrom(moment(), 1),
      selectedDay: moment()
    };
  }
  render() {
    const { monthMoments, selectedDay } = this.state;
    return (
      <Calendar
        monthGridProps={{
          monthMoments
        }}
        dayProps={{
          modifiers: [
            selectedModifier(selectedDay),
            emptyModifier,
            weekendModifier
          ],
          onClick: (_, { dayMoment }) =>
            this.setState({ selectedDay: dayMoment })
        }}
      />
    );
  }
}

There are also more complex examples like the large calendar displayed below:

react-barebones-calendar large-demo-png

The example code is available at src/examples/

Keywords