React
Lite
Month Picker

April 2025
2025
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec

Simple, modern and customizable month picker component for ReactJS.

Install

Using npm:

npm install react-lite-month-picker --save

Usage


import { useState } from 'react';
import { MonthPicker, MonthInput } from 'react-lite-month-picker';

function Example() {
  const [selectedMonthData, setSelectedMonthData] = useState({
    month: 9,
    year: 2023,
  });
  const [isPickerOpen, setIsPickerOpen] = useState(false);

  return (
    <>
      <div>
        <MonthInput
          selected={selectedMonthData}
          setShowMonthPicker={setIsPickerOpen}
          showMonthPicker={isPickerOpen}
        />
        {isPickerOpen ? (
          <MonthPicker
            setIsOpen={setIsPickerOpen}
            selected={selectedMonthData}
            onChange={setSelectedMonthData}
          />
        ) : null}
      </div>
    </>
  );
}

export default Example;

Selected month data

Currently selected month data is an object with the following structure:

{
  month: 9,
  year: 2023,
  monthName: 'September',
  monthShort: 'Sep'
}

It will get saved on set parent component state with onChangeevent.

Customization

Customize theMonthPickercomponent by passing the following props to it.

PropDescriptionDefault
bgColorMonthActiveBackground color of the active month. Accepts any valid CSS color value.#4ea3983e
bgColorMonthHoverBackground color of the hovered month. Accepts any valid CSS color value.#f4f4f4
borderRadiusMonthBorder radius of the month. Accepts any valid CSS border-radius value.7px
bgColorPickerBackground color of the month picker. Accepts any valid CSS color value.#fff
textColorColor of the text. Accepts any valid CSS color value.#000

Customize the MonthInputcomponent by passing props to it.

PropDescriptionDefault
bgColorBackground color of the input element. Accepts any valid CSS color value.#fff
bgColorHoverBackground color of the input element on hover. Accepts any valid CSS color value.#fff
textColorText color of the input element. Accepts any valid CSS color value.#000

Examples & Demos

Click the images below to see demos on CodeSandbox.

Default

Customized

License

React Lite Month Picker is licensed under the MIT license. Check the license file on Github for more information.