• Stars
    star
    145
  • Rank 253,731 (Top 6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 10 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

React.js Calendar Component (npm install react-calendar-component) ๐Ÿ“…

react-calendar

React calendar component inspired by CLNDR.js.

$ npm install react-calendar-component

Note: the npm name is react-calendar-component!

This is a low-level component for rendering monthly calendars using React. The component will call renderDay and renderHeader functions provided by you to make a calendar for the month of the given Date. Very basic default implementations are provided for both, but they can be overridden to fit your use case. This example shows how to create a regular grid calendar.

Live Demo

http://hanse.github.io/react-calendar/

Usage

import React, { Component } from 'react';
import { render } from 'react-dom';
import { Calendar } from 'react-calendar-component';
import moment from 'moment';
import 'moment/locale/nb';

class CalendarExample extends Component {
  state = {
    date: moment()
  };

  render() {
    return (
      <Calendar
        onChangeMonth={date => this.setState({ date })}
        date={this.state.date}
        onPickDate={date => console.log(date)}
        renderDay={({ day, classNames, onPickDate }) => (
          <div
            key={day.format()}
            className={cx(
              'Calendar-grid-item',
              day.isSame(moment(), 'day') && 'Calendar-grid-item--current',
              classNames
            )}
            onClick={e => onPickDate(day)}
          >
            {day.format('D')}
          </div>
        )}
        renderHeader={({ date, onPrevMonth, onNextMonth }) => (
          <div className="Calendar-header">
            <button onClick={onPrevMonth}>ยซ</button>
            <div className="Calendar-header-currentDate">
              {date.format('MMMM YYYY')}
            </div>
            <button onClick={onNextMonth}>ยป</button>
          </div>
        )}
      />
    );
  }
}

render(<CalendarExample />, document.getElementById('calendar'));

License

MIT

More Repositories

1

hot-redux-chassis

Modern React/Redux/RxJS application using all the latest and greatest stuff from the community ๐Ÿ”ฅ
TypeScript
19
star
2

node-jodel

Access Jodel through JavaScript (may not work anymore)
JavaScript
17
star
3

maconomy

Maconomy JavaScript library and CLI: More developer-friendly way to use Deltek's Maconomy ๐Ÿ’ธ
JavaScript
10
star
4

mopidy-anjuna

No-skip-queue Mopidy Web Client
JavaScript
9
star
5

click-heatmap

Generate simple screenshots of a web pages with heat map overlay of recorded user clicks.
JavaScript
7
star
6

markdown-latex-ntnu

A starting point for writing reports in Markdown that compile to LaTeX via Pandoc. (For NTNU)
TeX
5
star
7

lastfm-spotify

A PHP library that utilizes both the Last.fm API and the Spotify Metadata API to fetch track data
PHP
4
star
8

kafka-life-stream

Kafka Life Stream: Activity Tracking (Strava), Open Banking (Sbanken) and what not
TypeScript
4
star
9

webpack-express-middleware

Sweet Express and webpack integration
JavaScript
3
star
10

album-cover

Fetch album covers from last.fm
JavaScript
3
star
11

modern-react-workshop

TypeScript
3
star
12

bingo

Generate a bunch of A4 printable bingo cards ๐Ÿ–จ๐Ÿ“œ
TypeScript
2
star
13

dotfiles

~/
Ruby
2
star
14

react-native-fagkveld

Intern fagkveld Itera
JavaScript
2
star
15

neidel

It's basically Jodel (but for the browser!)
JavaScript
2
star
16

timetracking.tools

Time tracker w/ PouchDB persistence and React Hooks
TypeScript
2
star
17

visualizer

Demo of Web Audio API and Three.js
JavaScript
2
star
18

asamoah

Opinionated frontend setup for Browserify, React, stylus, nib and GNU Make.
CSS
1
star
19

koren.im

Personal homepage ๐Ÿคž
JavaScript
1
star
20

gnit

single-user git hosting for your extremely private repos (encrypted passwords etc)
JavaScript
1
star
21

dark-stack-machine

Run Dark Assembly code in the browser
JavaScript
1
star
22

ninjagains-routines

Routine definitions for routines available inside the Ninjagains Workout Tracking App. Available on the App Store.
TypeScript
1
star
23

word-wheel

word wheel generator made for a dude on a random forum
JavaScript
1
star
24

is-git-repo

determine if a directory is a git repo
JavaScript
1
star
25

screens-bug-repro

Reproduction of bug in react-native-screens
Objective-C
1
star
26

shiny-disco

Abakus jubileumskonkurranse
JavaScript
1
star
27

hanse

1
star