New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-range-month-picker

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-range-month-picker

Simple, modern and customizable month picker component for ReactJS.

latest
Source
npmnpm
Version
1.3.6
Version published
Maintainers
1
Created
Source

React Range Month Picker

https://img.shields.io/npm/dw/react-lite-month-picker npm GitHub top language GitHub

Simple, modern and customizable month picker component for ReactJS.

React Range Month Picker

Features

😀 Simple and easy to use.
🌶 Tiny: Minzipped size less than 1kB.
🧁 Highly customizable: Easily make it fit to your designs.
📅 Accessible: Fully accessible with keyboard navigation. Developed according the WCAG 2.1 accesibility guidelines.
🇫🇮 41 languages supported.
🚫 0 Dependencies: No surprise dependencies included.

Installation

Using npm:

npm install react-range-month-picker --save

Using yarn:

yarn add react-range-month-picker

Using bun:

bun install react-range-month-picker

Usage

import { useState } from "react";
import { MonthRangePicker } from "react-range-month-picker";

function Example() {
  const initialDate = new Date();
  const [date, setDate] = useState({
    from: new Date(initialDate.getFullYear(), initialDate.getMonth, 1),
    to: new Date(initialDate.getFullYear(), initialDate.getMonth, 0),
  });
  const selectedMonthData = {
    fromMonth: new Date(date.from).getMonth(),
    fromYear: new Date(date.from).getFullYear(),
    toMonth: new Date(date.to).getMonth(),
    toYear: new Date(date.to).getFullYear(),
  };
  const setSelectedMonthData = (data) => {
    setDate({
      from: new Date(data.fromYear, data.fromMonth, 1),
      to: new Date(data.toYear, data.toMonth, 0),
    });
  };

  return (
    <MonthRangePicker
      size="small"
      selected={selectedMonthData}
      onChange={setSelectedMonthData}
    />
  );
}

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 onChange event.

Customization

You can customize the MonthPicker component styles by passing props to it.

Prop nameDescriptionDefault value
bgColorMonthActiveBackground color of the active month.#4ea3983e
bgColorMonthHoverBackground color of the month on mouse hover.#f4f4f4
borderRadiusMonthBorder radius of the moth element.7px
bgColorPicker Background color of the picker element.#fff
textColorColor of the text.#000
sizeSize of the component. Accepts 'small' or 'large'.large
langLanguage. Accepts ISO 639-1 language code.en



You can customize the MonthInput component styles by passing props to it.

Prop nameDescriptionDefault value
bgColorBackground color of the input element.#fff
bgColorHoverBackground color of the input element on mouse hover.#fff
textColorColor of the text.#000
sizeSize of the component. Accepts 'small' or 'large'.large
langLanguage. Accepts ISO 639-1 language code.en

See full list of supported languages on the website.

License

MIT © rizkiaprita

Keywords

react

FAQs

Package last updated on 18 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts