All Projects → rubencodes → Recal

rubencodes / Recal

Licence: mit
A minimal, accessible React/Preact calendar component using modern CSS.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Recal

Pickadate.js
The mobile-friendly, responsive, and lightweight jQuery date & time input picker.
Stars: ✭ 7,753 (+3959.16%)
Mutual labels:  calendar, picker
Angular Calendar
A calendar component for Angular 12.0+ that can display events on a month, week or day view. The successor of angular-bootstrap-calendar.
Stars: ✭ 2,312 (+1110.47%)
Mutual labels:  calendar, calendar-component
Yycalendar
Simple and Clear Calendar
Stars: ✭ 46 (-75.92%)
Mutual labels:  calendar, calendar-component
React Colorful
🎨 A tiny (2,5 KB) color picker component for React and Preact apps
Stars: ✭ 951 (+397.91%)
Mutual labels:  picker, preact
Xamarin.plugin.calendar
Calendar plugin for Xamarin.Forms
Stars: ✭ 159 (-16.75%)
Mutual labels:  calendar, calendar-component
Calendarview
Android上一个优雅、万能自定义UI、仿iOS、支持垂直、水平方向切换、支持周视图、自定义周起始、性能高效的日历控件,支持热插拔实现的UI定制!支持标记、自定义颜色、农历、自定义月视图各种显示模式等。Canvas绘制,速度快、占用内存低,你真的想不到日历居然还可以如此优雅!An elegant, highly customized and high-performance Calendar Widget on Android.
Stars: ✭ 7,998 (+4087.43%)
Mutual labels:  calendar, calendar-component
React Native Persian Calendar Picker
Persian Calendar Picker Component for React Native
Stars: ✭ 83 (-56.54%)
Mutual labels:  calendar, calendar-component
Angular Moment Picker
Angular Moment Picker is an AngularJS directive for date and time picker using Moment.js.
Stars: ✭ 536 (+180.63%)
Mutual labels:  calendar, picker
Vacalendar
Custom Calendar for iOS in Swift
Stars: ✭ 184 (-3.66%)
Mutual labels:  calendar, calendar-component
Calendar Ios
Calendar View
Stars: ✭ 154 (-19.37%)
Mutual labels:  calendar, calendar-component
Vue Calendar
🏆 基于 vue 2.0 开发的轻量,高性能日历组件
Stars: ✭ 828 (+333.51%)
Mutual labels:  calendar, calendar-component
Vue Hash Calendar
移动端日期、时间选择插件,日期选择面板以日历形式展示。上下滑动切换周/月模式。支持两种模式:1,月模式,左右滑动切换月份。2、周模式,左右滑动切换周。
Stars: ✭ 163 (-14.66%)
Mutual labels:  calendar, calendar-component
Vue Ctk Date Time Picker
VueJS component to select dates & time, including a range mode
Stars: ✭ 707 (+270.16%)
Mutual labels:  calendar, picker
Whack A Mole
Offline-first arcade game for children
Stars: ✭ 40 (-79.06%)
Mutual labels:  preact, css-grid
React Modern Calendar Datepicker
A modern, beautiful, customizable date picker for React
Stars: ✭ 555 (+190.58%)
Mutual labels:  calendar, picker
Recyclercalendarandroid
A simple DIY library to generate your own custom Calendar View using RecyclerView, written in Kotlin
Stars: ✭ 83 (-56.54%)
Mutual labels:  calendar, calendar-component
React Timeline Gantt
A react Timeline component with virtual rendering
Stars: ✭ 347 (+81.68%)
Mutual labels:  calendar, calendar-component
Calendarview
An Easy to Use Calendar for iOS (Swift 5.0)
Stars: ✭ 429 (+124.61%)
Mutual labels:  calendar, calendar-component
Calendar
📆 calendar 日历
Stars: ✭ 119 (-37.7%)
Mutual labels:  calendar, picker
Things Calendar
Simple but elegant datepicker for the web — inspired by Things for mac
Stars: ✭ 165 (-13.61%)
Mutual labels:  calendar, picker


recal logo

📅 recal 📅

npm version license bundle size Lighthouse score: 100/100

A minimal, accessible React/Preact calendar component using modern CSS, for modern browsers. Now with a 100 Lighthouse Accessibility Audit score. It works with native Javascript dates, so there's no need to import any heavy dependencies like moment. For a set of functions for working with Javascript Dates, we recommend date-fns. For a more flexible, fully-featured set of calendar components, see react-dates.


example calendar

See a Live Demo

Try on CodePen

Installation

Using recal is simple. Just install the npm package:

npm i -S recal

Or, import recal and its stylesheet via CDN:

<link rel="stylesheet" type="text/css" href="https://unpkg.com/recal/lib/index.css" />
<script src="https://unpkg.com/recal"></script>

Usage

If you're using recal from npm, be sure to import the necessary modules into the file you wish to use it in.

// You can use React or Preact here—just make sure you have the proper aliasing.
import React from 'react';

// Calendar components.
import { DatePicker, DateRangePicker } from 'recal';

// Stylesheet for calendar.
import 'recal/lib/index.css';

Date Picker

To create a single date picker, use the DatePicker component as follows:

class MyDatePicker extends React.Component {
  state = {};

  onDateSelected = (selectedDate) => {
    this.setState({
      selectedDate
    });
  }

  render() {
    return (
      <DatePicker
        date={ this.state.selectedDate }
        onDateSelected={ this.onDateSelected } />
    );
  }
}

Date Range Picker

To create a date range picker, use the DateRangePicker component as follows:

class MyDateRangePicker extends React.Component {
  state = {};

  onStartDateSelected = (startDate) => {
    this.setState({
      startDate
    });
  }
  onEndDateSelected = (endDate) => {
    this.setState({
      endDate
    });
  }

  render() {
    return (
      <DateRangePicker
        startDate={ this.state.startDate }
        endDate={ this.state.endDate }
        onStartDateSelected={ this.onStartDateSelected }
        onEndDateSelected={ this.onEndDateSelected } />
    );
  }
}

Options

Both calendars have some required and some optional props.

// Used by DatePicker
selectedDate: PropTypes.instanceOf(Date),
onDateSelected: PropTypes.func,

// Used by DateRangePicker
startDate: PropTypes.instanceOf(Date),
endDate: PropTypes.instanceOf(Date),
onStartDateSelected: PropTypes.func,
onEndDateSelected: PropTypes.func,

// Used by either (optional)
onDateHovered: PropTypes.func,
onDateFocused: PropTypes.func,
isDateHighlighted: PropTypes.func,
isDateEnabled: PropTypes.func,
locale: PropTypes.string,
disabled: PropTypes.bool

Localization

Use the locale string prop on the calendar components to localize the month and days of the week into other languages (e.g. "en-US", "es-MX", etc.).

Accessibility

This set of calendars are optimized for screen readers as well as for keyboard-based navigation. The following shortcuts are available when the calendar is focused:

Key Direction Time
Left Arrow Back 1 day
Right Arrow Forward 1 day
Up Arrow Back 1 week
Down Arrow Forward 1 week
Page Up Back 1 month
Page Down Forward 1 month
Shift + Page Up Back 1 year
Shift + Page Down Forward 1 year
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].