react-month-year-picker

1.0.1 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i react-month-year-picker

Weekly Downloads

53

Version

1.0.1

License

MIT

Unpacked Size

40.4 kB

Total Files

6

Last publish

Collaborators

  • nclong87