simple-react-calendar

授权协议 Readme
开发语言 JavaScript
所属分类 Web应用开发、 常用JavaScript包
软件类型 开源软件
地区 不详
投 递 者 陶璞
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

simple-react-calendar Version Badge

npm badge


A simple calendar component for React based applications.

A component that is easy to start using, yet flexible when you need customization.

Usage

You can find the component's online demo here.

Screen

Install

Using npm

npm install simple-react-calendar

Using yarn

yarn add simple-react-calendar

Usage

import React, { Component } from 'react'

import SimpleReactCalendar from 'simple-react-calendar'

class MyApp extends Component {
  render() {
    return <SimpleReactCalendar activeMonth={new Date()} />
  }
}

Available component properties

All of the properties are optional, just rendering <Calendar /> will already give you a working calendar component.

Properties PropType Description
MonthHeaderComponent object or func replace the month header of the component with this node object or class function
activeMonth datePropType* any day within the month that you want initially displayed
blockClassName string base class name that will be used as a class prefix (see )
daysOfWeek [string] array of string represents the days
disableDaysOfWeek bool disable rendering days of the week
disabledIntervals [{start: datePropType, end: datePropType}] disabled intervals of dates. Array of objects [{start: Date(), end: Date()}]. When user try to select disabled date or date range which consist disabled date(s) inside, Notice will appear
headerNextArrow element any kind of react element will be rendered into the next month button (element)
headerNextTitle string text will be rendered as the title of the next month button Next month
headerPrevArrow element any kind of react element will be rendered into the previous month button (element)
headerPrevTitle string text will be rendered as the title of the previous month button, default is Previous month
highlighted {start: datePropType, end: datePropType} highlighted dates. Object {start: Date(), end: Date()}. Undefined by default
maxDate datePropType* latest date available for selection
minDate datePropType* earliest date available for selection
minNumberOfWeeks number minimum number of weeks in a month. Undefined by default
mode string one of range or single selection mode, one of either range or single. Default is single
onDayHover func a function that is called on mouseMove on days
onMonthChange func a function that is called whenever user changes the month. If defined then you have to handle month changing by yourself by changing activeMonth property
onSelect func a function that is called whenever user
onSelectionProgress func a function that is called whenever user changes
rangeLimit number limit number of days for selection (number)
selected selected dates. Can be ether single Date object if mode is single, or object {start: Date(), end: Date()} if mode is range
today datePropType* current date (useful when you want to show current date in different time zone). Default is new Date() selects a date (in single mode) or a dates range (range mode) selection. Works only in the range mode. When the function is passed then automatic range selection handing will be disabled.
weekStartsOn number the index of the first day of the week (0 - Sunday). Default is 1 - Monday

datePropType - number, string or instanceOf(Date)

Render Prop's Components

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

Expose date helper methods

You can easily override any helper methods, all of them exposed as pure functions.

Helper function Default function
getDayFormatted getDayFormatted
getISODate getISODate
getNoticeContent getNoticeContent

Class Names

simple-react-calendar follows BEM-like class naming approach and usessingle block name as a prefix. Default block class name is calendar, soelements will have names like calendar-day, calendar-month etc.

Block class name can be overrided with blockClassName 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
  • .is-prev - when is the previous month button
  • .is-next - when is the next month button
  • .is-disabled - when the button is disabled
Calendar week header (week days) .calendar-days_of_week
Calendar week header day (week day) .calendar-days_of_week_day
  • .is-weekend - when the day is the weekend
Calendar month (weeks wrapper element) .calendar-month
Calendar week (days wrapper element) .calendar-week
Calendar day .calendar-day
  • .is-selected - when the date is selected
  • .is-highlighted - when the date is highlighted
  • .is-today - when the date is current one
  • .is-start_selection - when the date is start day of selection
  • .is-end_selection - when the date is end day of selection
  • .is-current_month - when the date belongs to the current month
  • .is-prev_month - when the date belongs to the previous month
  • .is-next_month - when the date belongs to the next month
  • .is-weekend - when the date is the weekend
  • .is-working_day - when the date is the working day
  • .is-selectable - when the date can be selected
  • .is-not_selectable - when the date can't be selected
Calendar notice (notice element) .calendar-notice

Local development environment

Fork this repository and clone your version of the repository

Install dependencies

yarn

Start example server locally

yarn start

You now have examples running on http://localhost:9000

Local StoryBook

Fork this repository and clone your version of the repository

Install dependencies

yarn

Start example server locally

yarn storybook

You now have examples running on http://localhost:6006

  • 1.Toast: https://github.com/magicismight/react-native-root-toast 2.图标的使用: https://github.com/oblador/react-native-vector-icons 3.选择照片: https://github.com/lwansbrough/react-native-camera 4.二级菜单: https:

  • React Native 项目常用第三方组件汇总: https://github.com/KartikTalwar/rn-grid-view  gridView的使用 react-native-animatable 动画 react-native-carousel 轮播 react-native-countdown 倒计时 react-native-device-info 设备信息 react-n

  • 1. 路由器 Router a)BrowserRouter 返回目录 使用 HTML5 的 history API (pushState, replaceState 和 popstate 事件) 来保持 UI 与 URL 同步的<router> import { BrowserRouter } from 'react-router-dom' <BrowserRouter basename={

  • react-native-uploader //文件上传 https://github.com/aroth/react-native-uploader jpush-react-native //官方版本 https://github.com/jpush/jpush-react-native react-native-jpush 由 React Native 中文网开发维护。 https://git

  • 本文出处: http://blog.csdn.net/chichengjunma/article/details/52920137 React Native 项目常用第三方组件汇总:   react-native-animatable 动画   react-native-carousel 轮播   react-native-countdown 倒计时   react-native-device-i

  • react 国际化 by Preethi Kasireddy 通过Preethi Kasireddy React的国际化 (Internationalization in React) Internationalization is a big problem. If you want your application to make a worldwide impact, you have to

  • React-native-animatable 动画 react-native-carousel 轮播 react-native-countdown 倒计时 react-native-device-info 设备信息 react-native-fileupload 文件上传 react-native-icons 图标 react-native-image-picker 图片选择器 react-na

  • React 学习与实践资料索引 Overview: 概览 Principle: 设计理念 Case Study: 案例 Book: 书籍 Course & Conf: 视频教程与会议 Resource: 其他资源集锦 Tutorial: 入门教程 Concept: 概念 Coding: 基础编码 Component: 组件开发 Syntax: 语法 Props State Context DOM

  • React Native 项目常用第三方组件汇总: React-native-uploader //文件上传 https://github.com/aroth/react-native-uploader 0.gif jpush-react-native //官方版本 https://github.com/jpush/jpush-react-native react-native-jpush 由 R

  • 近期困扰于SPA在ios微信调用分享SDK失败的问题, 目前采用拿掉react-router路由,采用原始location.href的方式跳转,临时解决问题... 坑终究是坑,不填不足以平民愤... 这时候才发现react-router的升级至4.x,相比之前,多有不同之处,废话不多说,先搞个API整体的摸索一番。  对以上问题感兴趣的,欢迎交流 ^_^    重点分割线       具体栗子参见

  • React Native常用第三方组件汇总 React Native 项目常用第三方组件汇总:   react-native-animatable 动画   react-native-carousel 轮播   react-native-countdown 倒计时   react-native-device-info 设备信息   react-native-fileupload 文件上传   re

  • MUI - The React UI library for faster and easier web development. React Table - Lightweight and extensible data tables for React. React Flatpickr - Useful library used to select date. React ChartJS 2

  • reactjs 网站建设中常用的组件,基本涵盖了项目日常所需 griddle-react react-bootstrap react-cropper core-js Material UI superagent restful-error-es6 browserify react-select-popover 标签选择 react-infinite-scroll 无限滚动 semantic-ui

  • react-native-linear-gradient 颜色渐变处理 react-native-login 视频界面登录 react-native-keyboard-aware-scroll-view 键盘显示处理 react-native-popup-dialog 弹窗 react-native-dropdownalert 一种非常漂亮的alert弹窗方式,从状态栏往下弹窗; react-n

 相关资料
  • simple-react-full-stack This is a boilerplate to build a full stack web application using React, Node.js, Express and Webpack. It is also configured with webpack-dev-server, eslint, prettier and babel

  • Simple Universal React Redux The simplest possible Async Universal React & Redux boilerplate. This repo is an attempt to make the simplest server-side rendered (universal) async React Redux app. Boile

  • react-native-simple-markdown A component for rendering Markdown in React Native with native components, working with both iOS & Android. Pull requests are welcome! �� �� Getting started yarn add react

  • Simple Calendar A simple calendar with events and a customizable widget. A simple calendar with optional CalDAV synchronization. You can easily create recurring events and setup reminders, it can also

  • To install Tengine, just follow these three steps: $ ./configure $ make # make install By default, it will be installed to /usr/local/nginx. You can use the '--prefix' option to specify the root dire

  • 插入 // 单条插入 User user=new User(); // 省略entity属性赋值... ... elasticsearchTemplate.save(user); // 批量插入 LinkedList<User> users= new LinkedList<User>(); // 省略entity属性赋值... ... elasticsearchTemplate.save(user