react-month-picker-simple
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published

react-month-picker-simple is simplest month picker component.

Installation

npm install react-month-picker-simple

PlayGround

https://ey920911.github.io/react-month-picker-simple/

Simple example

basic style

basicStyle

Example Code

import React, { CSSProperties } from 'react';
import MonthPicker from 'react-month-picker-simple';

export default function () {
    return (
        <div style={{width:'300px'}}>
            <MonthPicker handleChange={(date: Date)=> {}}/>
        </div>
    )
}

customize style

customizeStyled

Example Code

import React, { CSSProperties } from 'react';
import MonthPicker from 'react-month-picker-simple';

const BaseStyle: CSSProperties ={
  backgroundColor: 'blue',
  border:'1px solid white',
  color:'white'
}

const SelectedStyle: CSSProperties ={
  backgroundColor: 'white',
  color:'black'
}

export default function () {
    return (
        <div style={{width:'300px'}}>
             <MonthPicker
                language="zh"
                buttonStyle={BaseButtonStyle}
                selectedButtonStyle={SelectedStyle}
                handleChange={(date: any) => {}}
            />
        </div>
    )
}

Props

All props list of react-month-picker-simple.

Name Required Type Default Description
handleChange true (date: Date) => void 1 The function to catch changed date
minYear false number currentYear - 20 The value of minium year to select year
maxYear false function currentYear The value of maxium year to select year
language false 'en', 'ko', 'zh' 'en' The language info
customMonth false string[] undefined The customed month info
buttonStyle false CSSProperties undefined The button style not selected
selectedButtonStyle false CSSProperties undefined The button style that selected

Package Sidebar

Install

npm i react-month-picker-simple

Weekly Downloads

36

Version

1.0.8

License

none

Unpacked Size

797 kB

Total Files

25

Last publish

Collaborators

  • ey920911