Skip to content

nclong87/react-month-year-picker

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published