0.7.0 • Published 5 years ago

react-calendar-month-view v0.7.0

Weekly downloads
35
License
MIT
Repository
github
Last release
5 years ago

react-calendar-month-view npm version

A simple and customizable monthly calendar component view.

Demo & Examples

Live Demo

To build the examples locally, clone this repo and run:

npm install
npm start

or

yarn install
yarn start

Then open localhost:8080 in a browser.

Installation

Install directly from NPM:

npm install react-calendar-month-view --save

or

yarn add react-calendar-month-view

Usage

Use this component to display a month view of a calendar with supplied event duration indicators.

import CalendarMonthView from 'react-calendar-month-view';

class App extends Component {
  // date is given as an ISO-8601 string
  _renderDay = (date, isSmallCalendar) => {
    // return a component to render for the given date
  };

  render() {
    return <CalendarMonthView renderDay={this._renderDay} />;
  }
}

Props

proptypedefaultdescription
widthstring"90%"Specifies the width of the calendar (height is dynamically set and therefore cannot be customized). Examples. "500px", "90vw", "90%"
renderDayfunctionnullCallback used to render a given day
onMonthChangefunctionnullCallback that is fired when the month is changed (Fires once on component mount)
titleTextStyleobjectnullCustom styles for the title text
dayNameTextStyleobjectnullCustom styles for the day names (header row of the calendar)
dayTextStyleobjectnullCustom styles for the numbers that correspond to the days on the calendar
activeDayStyleobjectnullCustom styles for the calendar tile corresponding to the current day
inactiveDayStyleobjectnullCustom styles for the calendar tile corresponding days that are not the current day

Functions:

renderDay(isoDate: string, isSmallCalendar: bool)

isoDate is a ISO-8601 string that represents the current day being rendered.\ isSmallCalendar is a boolean defining if the calendar is rendered as a "small" or "large" type

Example:

const renderDay = (isoDate, isSmallCalendar) => {
  return <div> ... </div>;
};

onMonthChange(startDate)

startDate is a ISO-8601 string representing the start date of the current month, after the month is changed (Fires once when component is mounted)

Example:

const onMonthChange = startDate => {
  // eg. retrieve data from gcal
};

Notes

Use the width to control the size of the calendar component.

0.7.0

5 years ago

0.6.0

5 years ago

0.5.0

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago