Cron Input

Standard five-field cron expression input with plain-English schedule readout and upcoming run times.

@drift-ui/cron-inputRegistry JSONOpen in v0
At 09:00, Monday through Friday
Upcoming 5 runs
  1. Mon, 2026-11-23 09:00
  2. Tue, 2026-11-24 09:00
  3. Wed, 2026-11-25 09:00
  4. Thu, 2026-11-26 09:00
  5. Fri, 2026-11-27 09:00
On this page

Installation

The CLI also installs the npm packages and registry items it builds on, and reads the style in your components.json to pick the Base UI or Radix build.

Usage

cron-input-usage.tsx
"use client"

import { useState } from "react"
import { CronInput } from "@/components/ui/cron-input"

export function BackupSchedule() {
  const [schedule, setSchedule] = useState("0 9 * * 1-5")

  return (
    <div className="flex flex-col gap-2">
      <label htmlFor="cron" className="text-sm font-medium">Backup schedule</label>
      <CronInput
        value={schedule}
        onValueChange={setSchedule}
        inputProps={{ id: "cron" }}
      />
    </div>
  )
}

Examples

Basic cron input

A standard five-field cron input with a plain-English schedule readout and next run times.

At 09:00, Monday through Friday
Upcoming 5 runs
  1. Mon, 2026-11-23 09:00
  2. Tue, 2026-11-24 09:00
  3. Wed, 2026-11-25 09:00
  4. Thu, 2026-11-26 09:00
  5. Fri, 2026-11-27 09:00

Preset schedules

Controlled cron input paired with quick preset buttons for common recurring intervals.

At 00:00 every day
Upcoming 5 runs
  1. Sun, 2026-11-22 00:00
  2. Mon, 2026-11-23 00:00
  3. Tue, 2026-11-24 00:00
  4. Wed, 2026-11-25 00:00
  5. Thu, 2026-11-26 00:00

API reference

CronInput

A standard five-field cron expression input with plain-English schedule readout and upcoming run times.

Prop
valuestringControlled cron expression value.
defaultValuestringDefault"* * * * *"Initial value in uncontrolled mode.
onValueChange(value: string) => voidFires whenever the cron expression text changes.
placeholderstringDefault"* * * * *"Placeholder text for the cron input field.
showDescriptionbooleanDefaulttrueWhether to display the plain-English schedule readout below the input.
showNextRunsbooleanDefaulttrueWhether to show the list of upcoming calculated run times.
nextRunsCountnumberDefault5Number of upcoming run times to calculate and display.
nextRunsFromDateReference date for upcoming runs calculation. Defaults to current time.
formatNextRun(date: Date) => stringCustom date formatting function for upcoming runs.
disabledbooleanDefaultfalseWhether the input is disabled.
readOnlybooleanDefaultfalseWhether the input is read-only.
inputPropsOmit<React.ComponentProps<"input">, "value" | "defaultValue" | "onChange" | "disabled" | "readOnly">Additional props passed directly to the inner input element.

Other props go to the <div>.

parseCron

parseCron(expression: string | undefined | null): ParseCronResult

Pure logic helper in @/lib/cron-input that parses, validates, and expands a standard 5-field cron expression.

describeCron

describeCron(expression: string | undefined | null): string

Pure logic helper in @/lib/cron-input that turns a 5-field cron expression into a plain-English sentence.

getNextRunTimes

getNextRunTimes(expression: string | undefined | null, count?: number, from?: Date): Date[]

Pure logic helper in @/lib/cron-input that computes the next N run times starting from a reference date, following POSIX matching rules.

Source

components/ui/cron-input.tsx