- Notifications
You must be signed in to change notification settings - Fork21
A simple react based calendar component to be used for selecting dates and date ranges
License
toptal/simple-react-calendar
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
⚠️ Please note that the repository is no longer maintained and was archived. If you need to use a calendar, please use theCalendar component fromPicasso component library orReact Day Picker library
A simple calendar component for React based applications.
A component that is easy to start using, yet flexible when you need customization.
You can find the component's online demohere.
npm install simple-react-calendar
yarn add simple-react-calendar
importReact,{Component}from'react'importSimpleReactCalendarfrom'simple-react-calendar'classMyAppextendsComponent{render(){return<SimpleReactCalendaractiveMonth={newDate()}/>}}
All of the properties are optional, just rendering<Calendar /> will already give you a working calendar component.
datePropType -number,string orinstanceOf(Date)
You can easily override any rendered part of the calendar by providing the proper render function as a Prop.
| Render Prop name | Default usage | Default Render Prop Component |
|---|---|---|
renderDay | (props) => <Day {...props} /> | RenderPropsComponents/Day/Day.tsx |
renderDayOfWeek | (props) => <DayOfWeek {...props} /> | RenderPropsComponents/DayOfWeek/DayOfWeek.tsx |
renderNotice | (props) => <Notice {...props} /> | RenderPropsComponents/Notice/Notice.tsx |
You can easily override any helper methods, all of them exposed as pure functions.
| Helper function | Default function |
|---|---|
getDayFormatted | getDayFormatted |
getISODate | getISODate |
getNoticeContent | getNoticeContent |
simple-react-calendar follows BEM-like class naming approach and usessingle block name as a prefix. Default block class name iscalendar, soelements will have names likecalendar-day,calendar-month etc.
Block class name can be overrided withblockClassName prop (see above).
| Description | Default Class Name | Modifier Class Names |
|---|---|---|
| Calendar (root element) | .calendar | |
| Calendar month header | .calendar-month_header | |
| Calendar month header title (month name) | .calendar-month_header_title | |
| Calendar header button (month switcher) | .calendar-header_button |
|
| Calendar week header (week days) | .calendar-days_of_week | |
| Calendar week header day (week day) | .calendar-days_of_week_day |
|
| Calendar month (weeks wrapper element) | .calendar-month | |
| Calendar week (days wrapper element) | .calendar-week | |
| Calendar day | .calendar-day |
|
| Calendar notice (notice element) | .calendar-notice |
Fork this repository and clone your version of the repository
Install dependencies
yarn
Start example server locally
yarn start
You now have examples running onhttp://localhost:9000
Fork this repository and clone your version of the repository
Install dependencies
yarn
Start example server locally
yarn storybook
You now have examples running onhttp://localhost:6006
About
A simple react based calendar component to be used for selecting dates and date ranges
Topics
Resources
License
Contributing
Uh oh!
There was an error while loading.Please reload this page.

