2.0.4 • Published 6 years ago
mreactcalendar v2.0.4
mreactcalendar
Calendar with day, week and month view for your React app.
- Add events to calendar
- Display Day wise, Week wise and Month wise
Instructions:
- Install by executing
npm install mreactcalendaroryarn add mreactcalendar. - Import by adding
import Calendar from 'mreactcalendar'. - Use by adding
<Calendar />. - Available props to
Calendarare :- Use
eventsprop to add events to the calendar.Eventsshould an array of objects with required property i. e.start,endandtitle.
- Other props are:
dayviewstart,dayviewendandviewthough they have default you can change it to provide your default value. - In order to enable drag and drop to calendar you can use
dropFromOutsideprop. - In order to disable drag and drop to previous date in the calendar you can use
disableDropOnPreviousDateprop as pass a boolean value. - Events can be clicked and to get the detailed data about data you can pass the prop
eventClickedwhich provide access to event data.
- Use
Before you continue
mreactcalendar is under constant development. This documentation is written for mreactcalendar v-2.0.0 .
Getting started
Compatibility
Your project needs to use React 16.3 or later.
mreactcalendar uses modern web technologies. That's why it's so fast and lightweight.
Installation
Add React-Calendar to your project by executing npm install mreactcalendar or yarn add mreactcalendar.
Usage
Here's an example of basic usage:
import React, { Component } from 'react';
import Calendar from 'mreactcalendar';
class MyApp extends Component {
state = {
events: {
start: new Date(),
endt: new Date(),
title: 'Hey!'
}
}
handleDrop = (event) => {
// with help of event data you can get access to date property.
}
eventPressed = event => {
// capute the event that has been clicked.
}
render() {
return (
<div>
<Calendar
events={this.state.events}
dropFromOutside={this.handleDrop}
dayviewstart='6:00'
dayviewend='20:59'
eventClicked={this.eventPressed}
view="month"
/>
</div>
);
}
}