npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-range-month-picker

v1.3.6

Published

Simple, modern and customizable month picker component for ReactJS.

Downloads

12

Readme

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 name | Description | Default value | | -------------------- | -------------------------------------------------- | ------------- | | bgColorMonthActive | Background color of the active month. | #4ea3983e | | bgColorMonthHover | Background color of the month on mouse hover. | #f4f4f4 | | borderRadiusMonth | Border radius of the moth element. | 7px | | bgColorPicker | Background color of the picker element. | #fff | | textColor | Color of the text. | #000 | | size | Size of the component. Accepts 'small' or 'large'. | large | | lang | Language. Accepts ISO 639-1 language code. | en |



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

| Prop name | Description | Default value | | -------------- | ----------------------------------------------------- | ------------- | | bgColor | Background color of the input element. | #fff | | bgColorHover | Background color of the input element on mouse hover. | #fff | | textColor | Color of the text. | #000 | | size | Size of the component. Accepts 'small' or 'large'. | large | | lang | Language. Accepts ISO 639-1 language code. | en |

See full list of supported languages on the website.

License

MIT © rizkiaprita