react-month-year-picker

ReactJs component for selecting month and year

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
react-month-year-picker
411.0.14 years ago4 years agoMinified + gzip package size for react-month-year-picker in KB

Readme

react-month-year-picker
ReactJs component for selecting month and year

NPM JavaScript Style Guide
Screenshot

Install

npm install --save react-month-year-picker

Usage

import React, { Component } from 'react';

import MonthYearPicker from 'react-month-year-picker';

export default class App extends Component {
  constructor(props) {
    super(props);
    this.state = {
      month: 10,
      year: 2018,
    };
  }
  render() {
    return (
      <div>
        <MonthYearPicker
          selectedMonth={this.state.month}
          selectedYear={this.state.year}
          minYear={2000}
          maxYear={2030}
          onChangeYear={year => this.setState({ year: year })}
          onChangeMonth={month => this.setState({ month: month })}
        />
        <h3>Selected month: {this.state.month}</h3>
        <h3>Selected year: {this.state.year}</h3>
      </div>
    );
  }
}

Run demo

npm run build
cd example
npm start

License

MIT © nclong87