All Projects → mfix22 → Calendarx

mfix22 / Calendarx

Licence: mit
📅 Your go-to, prescribed, Calendar component for React

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Calendarx

React Paginating
Simple, lightweight, flexible pagination ReactJS component ⏮⏪1️⃣2️⃣3️⃣⏩⏭
Stars: ✭ 89 (-19.09%)
Mutual labels:  render-props
React Responsive Select
A customisable, touchable, React select / multi-select form control. Built with keyboard and screen reader accessibility in mind
Stars: ✭ 98 (-10.91%)
Mutual labels:  accessible
Timex
A complete date/time library for Elixir projects.
Stars: ✭ 1,538 (+1298.18%)
Mutual labels:  calendar
React Native General Calendars
React Native Calendar Components 📆
Stars: ✭ 94 (-14.55%)
Mutual labels:  calendar
Flagged
Feature Flags for React made easy with hooks, HOC and Render Props
Stars: ✭ 97 (-11.82%)
Mutual labels:  render-props
Downshift
🏎 A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete, combobox or select dropdown components.
Stars: ✭ 10,183 (+9157.27%)
Mutual labels:  accessible
Android Calendarview Master
Android开发实现自定义日历、日期选择控件
Stars: ✭ 87 (-20.91%)
Mutual labels:  calendar
Pg Calendar
📆 beautiful and eidetic date picker
Stars: ✭ 109 (-0.91%)
Mutual labels:  calendar
Simple React Calendar
A simple react based calendar component to be used for selecting dates and date ranges
Stars: ✭ 97 (-11.82%)
Mutual labels:  calendar
Pylunarcalendar
简介:无需数据库,以《钦定协纪辨方书》为核心的python3 农历、黄历、二十四节气、节假日、星次、每日凶煞、每日值神、建除十二神、每日宜忌、彭祖百忌、每日五行、二十八星宿、天干地支、生辰八字、时辰凶吉等开源项目。背景: 由于三体运动(主要地球、太阳、月球)无法准确预测,目前二十四节气依然还是靠天文台观测,Yovey使用传说中[Y*D+C]-L 寿星通用公式 方法实际有很多天数不准,def getSolarTerms(_date)12个if嵌套判断让代码变得十分冗余,由简书网友“大咖_247c”首先发现计算不准问题……
Stars: ✭ 106 (-3.64%)
Mutual labels:  calendar
Quick Plan
Defines and schedules Garmin workouts
Stars: ✭ 93 (-15.45%)
Mutual labels:  calendar
Aircalendarview
Airbnb APP CalendarView
Stars: ✭ 96 (-12.73%)
Mutual labels:  calendar
React Video Renderer
Build custom video players effortless
Stars: ✭ 100 (-9.09%)
Mutual labels:  render-props
Calendar views
Collection of customisable calendar related widgets for Flutter.
Stars: ✭ 92 (-16.36%)
Mutual labels:  calendar
Fscalendar
A fully customizable iOS calendar library, compatible with Objective-C and Swift
Stars: ✭ 9,829 (+8835.45%)
Mutual labels:  calendar
Swift Week View
An iOS calendar library for displaying calendar events in a week view.
Stars: ✭ 88 (-20%)
Mutual labels:  calendar
Qbox
🐈 RxJava+Retrofit+Okhttp+Glide + A life tool App, contains modules: news; jokes; constellation fortune; LED; weather; calendar; two-dimensional code, and more ... 小秋魔盒是一个生活工具 App,主要功能有:新闻资讯;微信精选美文;笑话趣图;星座运势;LED字幕;天气;日历;二维码;手电筒;老黄历。在开发中尽可能多的用了目前比较流行的框架和库。
Stars: ✭ 1,360 (+1136.36%)
Mutual labels:  calendar
Vue Schedule Calendar
日程调度日历。
Stars: ✭ 110 (+0%)
Mutual labels:  calendar
A11y accordions
ES5 ARIA Accordion Component
Stars: ✭ 108 (-1.82%)
Mutual labels:  accessible
Ummalqura Calendar
Implementation of java.util.Calendar for the Umm Al-Qura calendar system.
Stars: ✭ 104 (-5.45%)
Mutual labels:  calendar

📅 Calendarx

Your go-to, prescribed, Calendar component for React

Calendarx is a state container that makes creating custom calendar components a breeze. With a simple API, Calendarx makes it easy to display days and events, change views, and advance between the months, weeks, and days.

npm bundle size code style: prettier All Contributors PRs Welcome jest


Getting Started

yarn add calendarx

or

npm install calendarx

Example Usage

import { Calendar } from 'calendarx'

import { Row, Column, Events } from './components'

const events = [{ date: new Date(), id: 'birthday-1' }] // optional

export default () => (
  <Calendar events={events}>
    {({ days, date, goToNext, goToPrev, goToToday }) => (
      <div>
        <Row>
          <span>{date.toDateString()}</span>
          <button onClick={() => goToPrev()}>&lt;</button>
          <button onClick={goToToday}>Today</button>
          <button onClick={() => goToNext()}>&gt;</button>
        </Row>
        {days.map((week, i) => (
          <Row key={i}>
            {week.map((day, j) => (
              <Column key={j}>
                {day.events.map((event) => (
                  <Event isToday={day.isToday} key={event.id} {...event} />
                ))}
              </Column>
            ))}
          </Row>
        ))}
      </div>
    )}
  </Calendar>
)

or use as a React hook:

import { useCalendar } from 'calendarx'

export default MyCalendar() {
  const { days } = useCalendar(options)

 // ...
}

for an Advanced example, check out:

Advanced CalendarX Example

Props

Name Default Type Description
children undefined Function Render prop component. See docs below for the options passed
initialDate, date new Date() Date, String, Number, Moment initialDate sets the initial state of date for uncontrolled usage, otherwise use date for controlled usage. Used as the date to center the calendar around
initialNumDays, numDays 35 Number Number of days the calendar should display. If numDays > 10, this will be raised to the next multiple of 7. Use initialNumDays for uncontrolled usage, numDays for controlled
events [] Array<{ date: DateLike } , { startDate: DateLike, endDate: DateLike }> Events passed into the calendar. These objects will be injected into the correct array by date. Use date for an event on a specific date, and startDate combined with endDate for events spanning multiple dates
weekStartsOn 0 Number[0-6] Weekday to start the week on. Sunday (0) - Saturday (6)
headers ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'] String[] Replace the headers that get passed to children, for convience
render undefined Function Optional, same as children

Note: the Calendarx days grid will adapt depending on the number of days that are specified in numDays. For example, if 4 is passed in, the first column will start with your initialDate. If 7 is passed in (anything <10), the calendar will align itself to the beginning of the week. If 10 < numDays < 365 (the default is 35), the calendar will align to include the entire month and potentially parts of the previous/next month in order to align the grid with your start of the week (default is Sunday).

Children Properties

The following will be passed to your props.children or props.render function:

Option Type Description
days Day[][] 2-dimensional grid of objects representing each calendar day
date Date Current date state
view String{'year','month','week','day'} View according to numDays. day if <=4, week if <= 10, month < 365, or year
jump Function(n: Number, units: {'years','months','weeks','days'}) Function to jump a specific amount of time
goToNext Function() Sets date state to next date according to numDays/view
goToToday Function() Set the date state to today
goToPrev Function() Same as goToNext, but in reverse
goToDate Function(date: DateLike) Set date state to arbitrary date

Types

Day

This object contains the following fields/getters:

  • date: Date
  • events: Event[]
  • isToday: Boolean
  • isSame(unit: 'year'|'month'|'week'|'day'): Boolean: Function

Event

Events will include the other properties you pass alongside date in your events prop.

Contributing

Please do! If you have ideas, bug fixes, or examples to showcase, please submit a PR/issue.

  1. yarn
  2. Make your changes
  3. yarn test
  4. Push a PR

Contributors

Thanks goes to these wonderful people (emoji key):

Michael Fix
Michael Fix

💻
Filipe
Filipe

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

License

MIT

Inspiration 💫

This project was inspired by Kyle Stetz's CLNDR.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].