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 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-cron-gen

v1.1.1

Published

[![Main Branch CD Pipeline](https://github.com/italomaio/react-cron-gen/actions/workflows/publish.yaml/badge.svg)](https://github.com/italomaio/react-cron-gen/actions/workflows/publish.yaml) [![npm version](https://img.shields.io/npm/v/react-cron-gen.svg)

Readme

⏱ React Cron Gen

Main Branch CD Pipeline npm version License

Built to deliver flexibility and user experience on creating cron expression in your react application

react-cron-gen make easy to build cron expressions in your application using useCronGen hook or by using CronGen component.

Install

This package supports various Node.js package managers for flexible installation:

# Using npm
npm install react-cron-gen

# Using pnpm
pnpm install react-cron-gen

# Using Yarn
yarn add react-cron-gen

@radix-ui/react-select is needed to render UI from CronGen component.

Usage

Once installed, you can import and use the useCronGen hook or CronGen component in your React application:

useCronGen hook

It provides methods to set singular fields, format cron expression and i18n objects to use in your own UI.

import { useCronGen } from 'react-cron-gen';

const { state, data, setField, setFrequency } = useCronGen({
  type: "unix",
  locale: "pt-BR",
});

// Formatted expression
<input value={state.expression} />

// Index starts at 0 but cron experession starts from 1 then you should increase index
<select onChange={e => setField('month', e.target.value)}>
    {data.months.map((value, index) => (
        <option key={value} value={(index + 1).toString()}>
            {value}
        </option>
    )}
</select>

CronGen component

It provides a production ready UI component. You could customize fields using css just by referencing classes in your CSS File.

.react-cron-gen__select-trigger,
.react-cron-gen__select-content,
.react-cron-gen__select-item,
.react-cron-gen__input {
    #CSS properties
}

Or by passing your custom classes to classes object. You can make use of tailwind classes too like:

classes: {
  select: {
    trigger: "h-10 bg-gray-500 etc";
  }
}

Or even if you want use the default style you should import css file from react-cron-gen

import "react-cron-gen/dist/styles.css";
<CronGen
  locale="pt-BR"
  type="unix"
  onChangeValue={(values) => console.log(values)}
/>

Props

The CronGen component accepts the following props:

| Prop | Type | Required | Description | Default | | :-------------- | :---------------------------------- | :------- | :------------------------------------------------------------ | :-------- | | classes | object | No | CSS classes for styling various parts of the component. | {} | | locale | 'pt-BR' \| 'en-US' | No | Sets the language for the component (e.g., 'en-US', 'pt-BR'). | 'en-US' | | type | 'unix' \| 'quartz' | No | Specifies the type of cron expression to generate. | 'unix' | | onChangeValue | (values: UseCronGenState) => void | Yes | Callback function triggered when the cron expression changes. | (N/A) |

License

This project is licensed under the MIT License - see the LICENSE file for details.