Skip to content

james075/react-day-picker

 
 

Repository files navigation

title

screen shot

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

Check out the examples to see its features.

npm version CircleCI coveralls Code Climate npm downloads

Quick start

Add the dependency to your project

yarn add react-day-picker

# or with npm
npm install react-day-picker --save

Using unpkg

Include the component without installing:

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

See this jsfiddle as example.

Using bower

bower install react-day-picker

Example

import React from 'react';
import DayPicker from "react-day-picker";

import "react-day-picker/lib/style.css"

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

class MyComponent extends React.Component {
  state = {
    selectedDay: undefined,
  };
  handleDayClick = (day, { selected }) => {
    this.setState({
      selectedDay: selected ? undefined : day,
    });
  };
  render() {
    return (
      <DayPicker
        disabledDays={sundays}
        selectedDays={this.state.selectedDay}
        onDayClick={this.handleDayClick}
      />
    );
  }
}

See this running example and read basic usage for a deeper explanation of the example above.

Docs and examples

Get support

Fork https://jsfiddle.net/gpbl/cggxvq6t to reproduce your problem.

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

About

Flexible date picker for React

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 96.3%
  • CSS 3.7%