Big Calendar

gcal/outlook like calendar component

README

react-big-calendar


An events calendar component built for React and made for modern browsers (read: not IE) and uses flexbox over the classic tables-caption approach.

Big Calendar Demo Image


[DEMO and Docs](https://jquense.github.io/react-big-calendar/examples/index.html)

Inspired by Full Calendar.

Use and Setup


yarn add react-big-calendar or npm install --save react-big-calendar

Include react-big-calendar/lib/css/react-big-calendar.css for styles, and make sure your calendar's container
element has a height, or the calendar won't be visible. To provide your own custom styling, see the Custom Styling topic.

Starters



Run examples locally


  1. ```sh
  2. $ git clone git@github.com:jquense/react-big-calendar.git
  3. $ cd react-big-calendar
  4. $ yarn
  5. $ yarn examples
  6. ```


Localization and Date Formatting


react-big-calendar includes three options for handling the date formatting and culture localization, depending
on your preference of DateTime libraries. You can use either the Moment.js, Globalize.js or date-fns localizers.

Regardless of your choice, you must choose a localizer to use this library:

Moment.js


  1. ``` js
  2. import { Calendar, momentLocalizer } from 'react-big-calendar'
  3. import moment from 'moment'

  4. const localizer = momentLocalizer(moment)

  5. const MyCalendar = (props) => (
  6.   <div>
  7.     <Calendar
  8.       localizer={localizer}
  9.       events={myEventsList}
  10.       startAccessor="start"
  11.       endAccessor="end"
  12.       style={{ height: 500 }}
  13.     />
  14.   </div>
  15. )
  16. ```

Globalize.js v0.1.1


  1. ``` js
  2. import { Calendar, globalizeLocalizer } from 'react-big-calendar'
  3. import globalize from 'globalize'

  4. const localizer = globalizeLocalizer(globalize)

  5. const MyCalendar = (props) => (
  6.   <div>
  7.     <Calendar
  8.       localizer={localizer}
  9.       events={myEventsList}
  10.       startAccessor="start"
  11.       endAccessor="end"
  12.       style={{ height: 500 }}
  13.     />
  14.   </div>
  15. )
  16. ```

date-fns v2


  1. ``` js
  2. import { Calendar, dateFnsLocalizer } from 'react-big-calendar'
  3. import format from 'date-fns/format'
  4. import parse from 'date-fns/parse'
  5. import startOfWeek from 'date-fns/startOfWeek'
  6. import getDay from 'date-fns/getDay'
  7. import enUS from 'date-fns/locale/en-US'

  8. const locales = {
  9.   'en-US': enUS,
  10. }

  11. const localizer = dateFnsLocalizer({
  12.   format,
  13.   parse,
  14.   startOfWeek,
  15.   getDay,
  16.   locales,
  17. })

  18. const MyCalendar = (props) => (
  19.   <div>
  20.     <Calendar
  21.       localizer={localizer}
  22.       events={myEventsList}
  23.       startAccessor="start"
  24.       endAccessor="end"
  25.       style={{ height: 500 }}
  26.     />
  27.   </div>
  28. )
  29. ```

Custom Styling


Out of the box, you can include the compiled CSS files and be up and running. But, sometimes, you may want to style
Big Calendar to match your application styling. For this reason, SASS files are included with Big Calendar.

  1. ```
  2.   @import 'react-big-calendar/lib/sass/styles';
  3.   @import 'react-big-calendar/lib/addons/dragAndDrop/styles'; // if using DnD
  4. ```

SASS implementation provides a variables file containing color and sizing variables that you can
update to fit your application. _Note:_ Changing and/or overriding styles can cause rendering issues with your
Big Calendar. Carefully test each change accordingly.

Join us on Reactiflux Discord


Join us on Reactiflux Discord community under the channel #libraries if you have any questions.