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

@vpfaiz/cron-builder-ui

v1.0.1

Published

A beautiful, customizable cron expression builder component for React, built with shadcn/ui design patterns

Readme

Cron Builder UI

A beautiful, customizable cron expression builder component for React applications. Built with TypeScript, Tailwind CSS, and Radix UI primitives.

Screenshots

Light Mode

Clean, modern interface with intuitive schedule type selection:

Light Mode

Dark Mode

Full dark mode support with excellent contrast and readability:

Dark Mode

Features

  • 🎨 Beautiful UI - Clean, modern interface with light/dark mode support
  • TypeScript Support - Fully typed for better developer experience
  • 🎯 Easy Integration - Simple API with minimal dependencies
  • 🔧 Customizable - Tailwind CSS classes for easy styling
  • 📱 Responsive - Works great on desktop and mobile devices
  • 🎪 Multiple Formats - Support for hourly, daily, weekly, monthly, yearly, and custom expressions
  • 🎭 Visual Feedback - Real-time preview of cron expressions in human-readable format
  • Accessible - Built with Radix UI primitives for excellent accessibility

Installation

npm install @vpfaiz/cron-builder-ui

Peer Dependencies

Make sure you have these peer dependencies installed:

npm install @radix-ui/react-toggle-group react react-dom

Quick Start

import React, { useState } from 'react';
import { CronBuilder } from '@vpfaiz/cron-builder-ui';
import '@vpfaiz/cron-builder-ui/styles/globals.css';

function App() {
  const [cronExpression, setCronExpression] = useState('0 0 * * 0');

  return (
    <div className="p-8">
      <h1>Schedule Configuration</h1>
      <CronBuilder 
        onChange={setCronExpression}
        defaultValue={cronExpression}
      />
      <p>Current expression: <code>{cronExpression}</code></p>
    </div>
  );
}

API Reference

CronBuilder Props

| Prop | Type | Required | Description | |------|------|----------|-------------| | onChange | (expression: string) => void | ✅ | Callback function called when the cron expression changes | | defaultValue | string | ❌ | Initial cron expression (defaults to '0 0 * * 0') | | className | string | ❌ | Additional CSS classes to apply to the component |

Utility Functions

getCronText(cronExpression: string)

Converts a cron expression to human-readable text.

import { getCronText } from '@vpfaiz/cron-builder-ui';

const result = getCronText('0 9 * * 1-5');
// result = { status: true, value: "At 09:00 AM, Monday through Friday" }

Styling

The component uses Tailwind CSS and CSS custom properties for theming. You can customize the appearance by:

1. Using the built-in dark mode

<div className="dark">
  <CronBuilder onChange={setCronExpression} />
</div>

2. Customizing CSS variables

:root {
  --background: 0 0% 100%;
  --foreground: 222.2 84% 4.9%;
  --selected: 222.2 47.4% 11.2%;
  --selected-foreground: 210 40% 98%;
  /* ... other variables */
}

3. Adding custom classes

<CronBuilder 
  className="my-custom-cron-builder" 
  onChange={setCronExpression} 
/>

Examples

Basic Usage

<CronBuilder onChange={console.log} />

With Custom Default

<CronBuilder 
  defaultValue="0 9 * * 1-5" 
  onChange={setCronExpression} 
/>

With Custom Styling

<CronBuilder 
  className="border rounded-lg p-4" 
  onChange={setCronExpression} 
/>

Supported Cron Patterns

The component supports standard 5-field cron expressions:

| Field | Values | Special Characters | |-------|--------|--------------------| | Minute | 0-59 | , - * | | Hour | 0-23 | , - * | | Day of Month | 1-31 | , - * ? | | Month | 1-12 | , - * | | Day of Week | 0-6 (Sun-Sat) | , - * ? |

Common Examples

  • 0 0 * * 0 - Every Sunday at midnight
  • 0 9 * * ? - Every day at 9 AM
  • 0 */2 * * ? - Every 2 hours
  • 15,45 * * * ? - Every hour at 15 and 45 minutes
  • 0 9 1 * ? - First day of every month at 9 AM
  • 0 9 * * 1-5 - Weekdays at 9 AM

Development

Running the Demo

git clone https://github.com/vpfaiz/cron-builder-ui.git
cd cron-builder-ui
npm install
npm run dev

Building

npm run build        # Build the demo app
npm run build:lib    # Build the library for distribution

Linting

npm run lint         # Check for linting errors
npm run lint:fix     # Fix linting errors automatically

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

MIT License - see the LICENSE file for details.

Acknowledgments


Made with ❤️ for the React community