https://github.com/williamluke4/react-year-month-selector
React Component for Selecting only the Year and Month
https://github.com/williamluke4/react-year-month-selector
month picker react selector year
Last synced: 6 months ago
JSON representation
React Component for Selecting only the Year and Month
- Host: GitHub
- URL: https://github.com/williamluke4/react-year-month-selector
- Owner: williamluke4
- License: mit
- Created: 2018-01-11T11:11:57.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T20:09:51.000Z (almost 2 years ago)
- Last Synced: 2025-04-01T15:45:07.909Z (6 months ago)
- Topics: month, picker, react, selector, year
- Language: TypeScript
- Size: 1.01 MB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
React-Month-Picker-Input
====================## Demo
Live demo: [williamluke4.github.io/react-year-month-selector](https://williamluke4.github.io/react-year-month-selector/)
## API
| Name | Types | Default | Description |
|---|---|---|---|
| year | number | void | Preselect year in calendar |
| month | number (0..11) | void | Preselect month in calendar.|
| open | boolean | false | State on the dialog |
| onChange | Function: (year: number, month: number) => any | - | onChange callback, receives `year` and `month` |
| onClose | Function: () => any | - | onChange callback, called when clicked outside of dialog |## Installation
```
npm install react-year-month-selector --save
```## Usage
React-Year-Month-Selector provides a dialog which returns the selected Year and Month
```js
import YearMonthSelector from 'react-year-month-selector';
import 'react-year-month-selector/dist/react-year-month-selector.css';console.log(month)}
open={this.state.open}
onClose={this.handleClose}
/>```