Giter Site home page Giter Site logo

dfrankland / react-day-picker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gpbl/react-day-picker

0.0 3.0 0.0 3.11 MB

Flexible date picker for React

Home Page: http://react-day-picker.js.org

License: MIT License

JavaScript 95.27% CSS 4.73%

react-day-picker's Introduction

title

screen shot

react-day-picker is a flexible date picker component for React.

Check out the examples to see its features.

npm version Bower build status coveralls Code Climate npm downloads

Quick start

Installing via npm

npm install react-day-picker --save

Using unpkg CDN

<script src="https://unpkg.com/react-day-picker"></script>

Installing via Bower

bower install react-day-picker --save

The bower package exposes a global DayPicker variable.

Example

import React from 'react';
import DayPicker, { DateUtils } from "react-day-picker";

function sunday(day) {
  return day.getDay() === 0;
}

class MyComponent extends React.Component {
  state = {
    selectedDay: new Date(),
  }
  handleDayClick(e, day, { selected, disabled }) {
    if (disabled) {
      return;
    }
    if (selected) {
      this.setState({ selectedDay: null })
    } else {
      this.setState({ selectedDay: day });
    }
  },
  render() {
    return (
      <DayPicker
        initialMonth={ new Date(2016, 1) }
        disabledDays={ sunday }
        selectedDays={ day => DateUtils.isSameDay(this.state.selectedDay, day) }
        onDayClick={ this.handleDayClick.bind(this) }
    />);
  }
}

See Basic usage for a deeper explanation of the example above.

Docs and examples

Get support

Contribute

  • File bugs and feature requests in the issues page
  • Check out the source code on Github
  • Pull requests are welcome! If you are planning a pull request with lot of changes, please add an issue to discuss your idea first
    • See how to start the project locally here

react-day-picker's People

Contributors

gpbl avatar srph avatar limscoder avatar makenosound avatar boatkorachal avatar tomasberg avatar hugoduraes avatar zaygraveyard avatar stanislav-ermakov avatar iancmyers avatar kblcuk avatar adidahiya avatar adambbecker avatar hideto0710 avatar gitter-badger avatar nonmanifold avatar majapw avatar johannesd avatar jkillian avatar megheaiulian avatar fcsonline avatar fczuardi avatar davidspiess avatar frandsaw avatar akirk avatar webbushka avatar

Watchers

James Cloos avatar Dylan Frankland avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.