Convert Figma logo to code with AI

jquense logoreact-big-calendar

gcal/outlook like calendar component

7,712
2,218
7,712
357

Top Related Projects

Full-sized drag & drop event calendar in JavaScript

An easily internationalizable, mobile-friendly datepicker library for the web

Ultimate calendar for your React app.

gcal/outlook like calendar component

AutoForm is a Meteor package that adds UI components and helpers to easily create basic forms with automatic insert and update events, and automatic reactive validation.

Quick Overview

React Big Calendar is a flexible and customizable calendar component for React applications. It provides a full-featured event calendar that supports various views (month, week, day, agenda) and allows for easy integration of events and appointments.

Pros

  • Highly customizable with numerous props and styling options
  • Supports multiple calendar views (month, week, day, agenda)
  • Responsive design that works well on both desktop and mobile devices
  • Extensive documentation and active community support

Cons

  • Learning curve can be steep for complex customizations
  • Some users report performance issues with large datasets
  • Limited built-in internationalization support
  • Occasional conflicts with other React libraries or styling frameworks

Code Examples

  1. Basic calendar setup:
import { Calendar, momentLocalizer } from 'react-big-calendar'
import moment from 'moment'

const localizer = momentLocalizer(moment)

const MyCalendar = (props) => (
  <Calendar
    localizer={localizer}
    events={myEventsList}
    startAccessor="start"
    endAccessor="end"
    style={{ height: 500 }}
  />
)
  1. Custom event rendering:
const MyEvent = ({ event }) => (
  <div>
    <strong>{event.title}</strong>
    <p>{event.description}</p>
  </div>
)

const MyCalendar = (props) => (
  <Calendar
    components={{
      event: MyEvent
    }}
    // ... other props
  />
)
  1. Handling event selection:
const handleSelectEvent = (event) => {
  console.log(event)
  // Open modal, update state, etc.
}

const MyCalendar = (props) => (
  <Calendar
    onSelectEvent={handleSelectEvent}
    // ... other props
  />
)

Getting Started

  1. Install the package:

    npm install react-big-calendar moment
    
  2. Import and set up the calendar in your React component:

    import { Calendar, momentLocalizer } from 'react-big-calendar'
    import moment from 'moment'
    import 'react-big-calendar/lib/css/react-big-calendar.css'
    
    const localizer = momentLocalizer(moment)
    
    const MyCalendar = () => (
      <Calendar
        localizer={localizer}
        events={[]}
        startAccessor="start"
        endAccessor="end"
        style={{ height: '100vh' }}
      />
    )
    
    export default MyCalendar
    
  3. Add events to the calendar by passing an array of event objects to the events prop.

Competitor Comparisons

Full-sized drag & drop event calendar in JavaScript

Pros of FullCalendar

  • More comprehensive feature set, including support for various calendar views (month, week, day, list)
  • Better documentation and extensive API
  • Larger community and more frequent updates

Cons of FullCalendar

  • Steeper learning curve due to its extensive features
  • Larger bundle size, which may impact performance for simpler use cases
  • Requires additional setup for React integration (react-fullcalendar wrapper)

Code Comparison

React-Big-Calendar:

import { Calendar, momentLocalizer } from 'react-big-calendar'
import moment from 'moment'

const localizer = momentLocalizer(moment)

<Calendar
  localizer={localizer}
  events={myEventsList}
  startAccessor="start"
  endAccessor="end"
/>

FullCalendar:

import FullCalendar from '@fullcalendar/react'
import dayGridPlugin from '@fullcalendar/daygrid'

<FullCalendar
  plugins={[dayGridPlugin]}
  initialView="dayGridMonth"
  events={myEventsList}
/>

Both libraries offer React-compatible calendar components, but FullCalendar requires additional plugins for specific views. React-Big-Calendar provides a more straightforward setup for basic use cases, while FullCalendar offers more customization options at the cost of increased complexity.

An easily internationalizable, mobile-friendly datepicker library for the web

Pros of react-dates

  • Focused on date range selection, offering a more specialized and refined experience for this specific use case
  • Highly customizable appearance with extensive theming options
  • Better internationalization support out of the box

Cons of react-dates

  • Limited to date selection functionality, lacking full calendar view and event management features
  • Steeper learning curve due to more complex API and configuration options
  • Larger bundle size, which may impact performance in some applications

Code Comparison

react-dates:

import { DateRangePicker } from 'react-dates';

<DateRangePicker
  startDate={this.state.startDate}
  endDate={this.state.endDate}
  onDatesChange={({ startDate, endDate }) => this.setState({ startDate, endDate })}
  focusedInput={this.state.focusedInput}
  onFocusChange={focusedInput => this.setState({ focusedInput })}
/>

react-big-calendar:

import { Calendar, momentLocalizer } from 'react-big-calendar';
import moment from 'moment';

const localizer = momentLocalizer(moment);

<Calendar
  localizer={localizer}
  events={myEventsList}
  startAccessor="start"
  endAccessor="end"
  style={{ height: 500 }}
/>

Both libraries offer React components for date-related functionality, but react-dates focuses on date range selection, while react-big-calendar provides a full calendar view with event management capabilities. The choice between them depends on the specific requirements of your project.

Ultimate calendar for your React app.

Pros of react-calendar

  • Lightweight and focused solely on calendar functionality
  • Easier to customize and style due to simpler structure
  • Better accessibility support out of the box

Cons of react-calendar

  • Limited to basic calendar view, lacks advanced features like event management
  • Less suitable for complex scheduling applications
  • Requires additional components for time selection or event handling

Code Comparison

react-calendar:

import Calendar from 'react-calendar';

function MyApp() {
  return (
    <Calendar
      onChange={onChange}
      value={date}
    />
  );
}

react-big-calendar:

import { Calendar, momentLocalizer } from 'react-big-calendar';
import moment from 'moment';

const localizer = momentLocalizer(moment);

function MyCalendar() {
  return (
    <Calendar
      localizer={localizer}
      events={myEventsList}
      startAccessor="start"
      endAccessor="end"
    />
  );
}

react-calendar is more straightforward for basic calendar needs, while react-big-calendar offers more advanced features for complex scheduling applications. The choice between them depends on the specific requirements of your project.

gcal/outlook like calendar component

Pros of react-big-calendar

  • Comprehensive and feature-rich calendar component for React applications
  • Highly customizable with various view options (month, week, day, agenda)
  • Supports drag-and-drop functionality for event management

Cons of react-big-calendar

  • Learning curve can be steep due to its extensive API and configuration options
  • May have performance issues with large datasets or complex event rendering
  • Limited built-in theming options, requiring additional customization for unique designs

Code Comparison

Both repositories are the same, so there's no code comparison to make. Here's a basic usage example of react-big-calendar:

import { Calendar, momentLocalizer } from 'react-big-calendar'
import moment from 'moment'

const localizer = momentLocalizer(moment)

const MyCalendar = props => (
  <Calendar
    localizer={localizer}
    events={myEventsList}
    startAccessor="start"
    endAccessor="end"
    style={{ height: 500 }}
  />
)

Summary

react-big-calendar is a powerful and flexible calendar component for React applications. It offers a wide range of features and customization options, making it suitable for various use cases. However, its complexity may require more time to master, and performance optimizations might be necessary for large-scale applications. Overall, it's a solid choice for developers needing a comprehensive calendar solution in their React projects.

AutoForm is a Meteor package that adds UI components and helpers to easily create basic forms with automatic insert and update events, and automatic reactive validation.

Pros of meteor-autoform

  • Seamless integration with Meteor's reactive data system
  • Automatic form generation based on schema definitions
  • Built-in support for complex form layouts and custom input types

Cons of meteor-autoform

  • Limited to Meteor framework, not suitable for standalone React projects
  • Steeper learning curve for developers unfamiliar with Meteor ecosystem
  • Less flexibility in customizing calendar-specific features

Code Comparison

meteor-autoform:

AutoForm.hook('myForm', {
  onSubmit: function (insertDoc, updateDoc, currentDoc) {
    // Handle form submission
    this.done();
    return false;
  }
});

react-big-calendar:

import { Calendar, momentLocalizer } from 'react-big-calendar'
import moment from 'moment'

const localizer = momentLocalizer(moment)

<Calendar
  localizer={localizer}
  events={myEventsList}
  startAccessor="start"
  endAccessor="end"
/>

While meteor-autoform excels in form generation and Meteor integration, react-big-calendar is specifically designed for calendar functionality in React applications. meteor-autoform is more versatile for general form handling, but react-big-calendar offers specialized features for calendar views and event management. The choice between them depends on the project's framework and specific requirements for form handling versus calendar functionality.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

react-big-calendar

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

Big Calendar Demo Image

DEMO and Docs

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

$ git clone git@github.com:jquense/react-big-calendar.git
$ cd react-big-calendar
$ yarn
$ yarn storybook

Localization and Date Formatting

react-big-calendar includes four 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, date-fns, Day.js localizers.

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

Moment.js

import { Calendar, momentLocalizer } from 'react-big-calendar'
import moment from 'moment'

const localizer = momentLocalizer(moment)

const MyCalendar = (props) => (
  <div>
    <Calendar
      localizer={localizer}
      events={myEventsList}
      startAccessor="start"
      endAccessor="end"
      style={{ height: 500 }}
    />
  </div>
)

Globalize.js v0.1.1

import { Calendar, globalizeLocalizer } from 'react-big-calendar'
import globalize from 'globalize'

const localizer = globalizeLocalizer(globalize)

const MyCalendar = (props) => (
  <div>
    <Calendar
      localizer={localizer}
      events={myEventsList}
      startAccessor="start"
      endAccessor="end"
      style={{ height: 500 }}
    />
  </div>
)

date-fns v2

import { Calendar, dateFnsLocalizer } from 'react-big-calendar'
import format from 'date-fns/format'
import parse from 'date-fns/parse'
import startOfWeek from 'date-fns/startOfWeek'
import getDay from 'date-fns/getDay'
import enUS from 'date-fns/locale/en-US'

const locales = {
  'en-US': enUS,
}

const localizer = dateFnsLocalizer({
  format,
  parse,
  startOfWeek,
  getDay,
  locales,
})

const MyCalendar = (props) => (
  <div>
    <Calendar
      localizer={localizer}
      events={myEventsList}
      startAccessor="start"
      endAccessor="end"
      style={{ height: 500 }}
    />
  </div>
)

Day.js

Note that the dayjsLocalizer extends Day.js with the following plugins:

import { Calendar, dayjsLocalizer } from 'react-big-calendar'
import dayjs from 'dayjs'

const localizer = dayjsLocalizer(dayjs)

const MyCalendar = (props) => (
  <div>
    <Calendar
      localizer={localizer}
      events={myEventsList}
      startAccessor="start"
      endAccessor="end"
      style={{ height: 500 }}
    />
  </div>
)

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.

  @import 'react-big-calendar/lib/sass/styles';
  @import 'react-big-calendar/lib/addons/dragAndDrop/styles'; // if using DnD

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 The Community

Help us improve Big Calendar! Join us on Slack. (Slack invite links do expire. If you can't get in, just file an issue and we'll get a new link.)

Translations

NPM DownloadsLast 30 Days