Skip to content
Browse documentation

A schedule field people can read: cron or plain English in, the meaning in words and the next runs out, with clock changes flagged.

Used forScheduled jobsReport emailsWorkflow triggersDeveloper platforms

Install with the shadcn CLI

$ npx shadcn@latest add @hairline/cron-input

Older shadcn CLI, or a network that blocks ui.shadcn.com? Install by URL: shadcn add https://hairlineui.com/r/cron-input.json. More

Templates

Need the whole page?

65 Next.js landing pages, each designed from scratch. Try any of them live; one is $39, all of them $159, and 8 are free.

Where it’s used

  • Scheduled jobs

    Let people choose when a sync, an export or a backup runs.

  • Report emails

    Weekly digests and reports that go out at the time each customer picks.

  • Workflow triggers

    The “run on a schedule” step in automation tools and workflow builders.

  • Developer platforms

    Cron settings for functions and workers, with the next runs shown before anything is saved.

What it handles for you

Most schedule fields are a bare text box and a link to a cron cheat sheet, so people save schedules they can’t read and find out in March that a job never ran. This field explains itself as you type.

Instead of wiring upa cron cheat sheetcron-parsercronstruetime-zone mathsa presets dropdown
  1. Every part is named

    Minute, hour, day, month and weekday sit under their parts, and the part you’re editing lights up.

  2. It says it in words

    “At 09:00, Monday to Friday”, updated with every keystroke.

  3. It shows the next runs

    The next five times it fires, in the schedule’s own time zone, before anything is saved.

  4. It reads plain English

    Type “every weekday at 9am” or “last friday of the month at 17:30” and Enter turns it into cron.

  5. It points at mistakes

    The wrong part turns red and says why: “The hour goes from 0 to 23, not 24.”

  6. It catches clock changes

    Runs that daylight saving skips or repeats are flagged, in London, New York or any other zone.

Overview

Schedules for jobs, reports and backups usually come down to a bare text box for "0 9 * * 1-5" and a link to a cron cheat sheet. Here each part of the expression has its name under it, and the part your caret is in lights up with a hairline that glides from part to part. The line below says it in words ("At 09:00, Monday to Friday") and the next five runs are listed in the schedule's time zone; as you edit, their hours and minutes roll to the new times. You can also type "every weekday at 9am": it's read as you type and Enter turns the words into cron. Presets have a highlight that slides to whichever one matches, and picking one morphs the expression into it, with the characters both share staying put. A mistake turns its part red and says what's wrong while the last good runs stay, dimmed, so nothing jumps. A run that a clock change skips or repeats says so, which is the bug nobody notices until March.

States

typing
The parts are spread with word spacing so their names (10.5px) fit under them. The name under the part your caret is in turns to the text colour and a 1px line glides to it (300ms); names follow their parts as the text changes (340ms).
meaning
The sentence under the field crossfades whole when it changes: the old one lifts out through a 4px blur in 180ms while the new one rises in (380ms, 60ms later).
runs
The next runs list day, time and how long until each. Hours and minutes roll in the direction they changed (700ms), dates and "in 3 h" morph letter by letter, and the list updates on each new minute.
english
Text with words that aren't cron names is read as English. The part names fold away (320ms), the sentence says what it understood and which cron it makes, and Enter or leaving the field morphs the words into the expression.
preset
A pill highlight slides to the preset that matches the expression (380ms). Picking one morphs the expression into the preset: characters both share glide, the rest rise in through a blur.
invalid
The part at fault gets a red line and a red name, the sentence says why ("The hour goes from 0 to 23, not 24.") and the runs stay at 45% opacity until the text is valid again. Escape morphs back to the last valid expression.
clocks
In a zone with daylight saving, a run at a time the clocks skip or repeat gets an amber mark and a line saying which.

Usage

usage.tsx
import { CronInput } from "@/components/cron-input";<CronInput  defaultValue="0 9 * * 1-5"  onValueChange={(expression) => setSchedule(expression)}/>

Works with

Schedules your users choose

Each workspace picks its own schedule and zone, so they can’t be fixed triggers in your config. Save them through the same parser, then let one route that runs every minute ask nextRuns whether this minute is due for each.

example.tsx
// app/settings/actions.ts"use server";import { parseCron } from "@/components/cron-parse";export async function saveSchedule({ cron, timeZone }: { cron: string; timeZone: string }) {  const parsed = parseCron(cron);  if (!parsed.ok) return { error: parsed.message };  await db.workspace.update({ where: { id: await workspaceId() }, data: { digestCron: parsed.schedule.expression, digestZone: timeZone } });  return { ok: true };}// app/settings/schedule.tsx"use client";import { CronInput } from "@/components/cron-input";export function DigestSchedule({ cron, timeZone }: { cron: string; timeZone: string }) {  const schedule = { cron, timeZone };  return (    <CronInput      label="Digest schedule"      defaultValue={cron}      defaultTimeZone={timeZone}      timeZones={["UTC", "Europe/London", "America/New_York", "Asia/Kolkata"]}      onValueChange={(next) => saveSchedule({ ...schedule, cron: (schedule.cron = next) })}      onTimeZoneChange={(zone) => saveSchedule({ ...schedule, timeZone: (schedule.timeZone = zone) })}    />  );}// app/api/cron/route.ts: runs every minute (vercel.json: "crons": [{ "path": "/api/cron", "schedule": "* * * * *" }])import { nextRuns, parseCron } from "@/components/cron-parse";export async function GET() {  const minute = Math.floor(Date.now() / 60_000) * 60_000;  const workspaces = await db.workspace.findMany({ where: { digestCron: { not: null } } });  for (const w of workspaces) {    const parsed = parseCron(w.digestCron!);    if (!parsed.ok) continue;    // Due when its first run after the previous minute is this minute.    const [next] = nextRuns(parsed.schedule, { from: new Date(minute - 1), count: 1, timeZone: w.digestZone });    if (next?.at.getTime() === minute) await sendDigest(w.id);  }  return Response.json({ ok: true });}

Props

value / defaultValue= "0 9 * * 1-5"
string
The schedule as cron. defaultValue may also be English ("every weekday at 9am"); the field starts with the words.
onValueChange
(expression, schedule) => void
Each valid expression (tidied to single spaces, @macros expanded) and its parsed fields.
timeZone / defaultTimeZone= "UTC"
string
The IANA zone the schedule runs in; the runs are listed in it. Many schedulers (Vercel, GitHub Actions) only run in UTC.
timeZones
string[]
Zones to choose from. With two or more, the zone is a dropdown (Pill select) showing each zone's current offset.
onTimeZoneChange
(timeZone) => void
Called when a zone is picked.
runs= 5
number
How many upcoming runs to list; 0 hides them.
presets= CRON_PRESETS
{ label, expression }[]
Shortcuts above the field; [] hides them.
english= true
boolean
Read schedules typed in English.
hour12= false
boolean
Write times as 1:30pm.
label= "Schedule"
string
Accessible name of the field.
name
string
Submits the expression with a form.

Accessibility and motion

  • Five-field Unix cron: minute, hour, day, month, weekday, with names (MON, JAN), lists, ranges, steps, @daily-style shortcuts, L for the last day of the month, and FRI#2 or 5L for the nth or last weekday. 0 and 7 are Sunday. When both day and weekday are set, either one matching runs it, as in Unix cron; the sentence says so.
  • English it reads: every N minutes or hours, from 9am to 5pm, weekdays, weekends, named days and ranges of them, the 1st and 15th, the last day, the second Tuesday, the last Friday, months, and times like 9, 9:30, 5pm, noon and midnight. What it can't say in cron ("9:30 and 17:00") it doesn't guess at.
  • parseCron, describeCron, nextRuns and parseSchedule come from cron-parse.ts, which has no React in it, so a server or a worker can check and describe schedules the same way.
  • The input has the field's label and is described by the sentence under it; errors mark it aria-invalid. The meaning is announced once typing pauses, never on each keystroke. Each run has its full text for screen readers; the rolling digits are hidden from them.
  • Runs are worked out in the zone with Intl, day by day for up to six years, so a schedule that never fires (31 February) says so instead of hanging.
  • Reduced motion: no glides, rolls or morphs; text and numbers change in place.

Requirements

React 19, Tailwind CSS v4 and shadcn/ui theme variables (any style, light and dark). Icons from lucide-react.

The CLI also installs Text morph, Number roll.

Source

"use client";import * as React from "react";import { CRON_FIELDS, cronTokens, describeCron, nextRuns, parseCron, parseSchedule, type CronParse, type CronSchedule } from "./cron-parse";import { NumberRoll } from "./number-roll";import { PillSelect } from "./pill-select";import { TextMorph } from "./text-morph";/* ───────────────────────────────────────────────────────── * CRON INPUT: a schedule field people can read * *   type      a cron expression; each part has its name under *             it, and the part your caret is in lights up and *             gets a hairline that glides from part to part *   explain   the line below says it in words ("At 09:00, *             Monday to Friday") and crossfades as you type *   runs      the next five times it fires, in the schedule's *             time zone; hours and minutes roll as you edit *   english   "every weekday at 9am" works too: it's read as *             you type, and Enter turns the words into cron *   presets   a highlight slides to the preset that matches, *             and picking one morphs the expression into it: *             the parts both share stay where they are *   wrong     the part at fault turns red and says why; the last *             good runs stay, dimmed, so nothing jumps *   clocks    a run that a clock change skips or repeats says so * ───────────────────────────────────────────────────────── */export interface CronPreset {  label: string;  expression: string;}export interface CronInputProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "defaultValue" | "onChange"> {  /** The schedule, controlled: a cron expression. */  value?: string;  /** A cron expression, or a schedule in English ("every weekday at 9am"). */  defaultValue?: string;  /** Called with each valid expression (tidied) and what it means. */  onValueChange?: (expression: string, schedule: CronSchedule) => void;  /** The zone the schedule runs in. Many schedulers only run in UTC. */  timeZone?: string;  defaultTimeZone?: string;  /** Zones to choose from; with two or more, the zone becomes a dropdown. */  timeZones?: string[];  onTimeZoneChange?: (timeZone: string) => void;  /** How many upcoming runs to list; 0 hides the list. */  runs?: number;  /** Shortcuts above the field; [] hides them. */  presets?: CronPreset[];  /** Read schedules typed in English. */  english?: boolean;  /** 1:30pm instead of 13:30. */  hour12?: boolean;  /** Accessible name of the field. */  label?: string;  locales?: string | string[];  disabled?: boolean;  name?: string;}export const CRON_PRESETS: CronPreset[] = [  { label: "Every 15 min", expression: "*/15 * * * *" },  { label: "Hourly", expression: "0 * * * *" },  { label: "Daily 09:00", expression: "0 9 * * *" },  { label: "Weekdays 09:00", expression: "0 9 * * 1-5" },  { label: "Mondays 08:00", expression: "0 8 * * 1" },  { label: "Monthly", expression: "0 0 1 * *" },];const EASE = "cubic-bezier(0.16,1,0.3,1)";const FIELD_LABELS = ["minute", "hour", "day", "month", "weekday"];const NAMES = new Set(["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC", "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT", "L", "W"]);/** The field's type: one size for the input, its measuring copy and its morphing copy. */const TYPE = "font-mono text-[14.5px] tracking-[0.02em] [@media(pointer:coarse)]:text-[16px]";const reducedQuery = "(prefers-reduced-motion: reduce)";const subscribeReduced = (onChange: () => void) => {  const query = window.matchMedia(reducedQuery);  query.addEventListener("change", onChange);  return () => query.removeEventListener("change", onChange);};const useReducedMotion = () =>  React.useSyncExternalStore(subscribeReduced, () => window.matchMedia(reducedQuery).matches, () => false);const tidy = (text: string) => text.trim().split(/\s+/).join(" ");/** English if any word isn't a cron name (MON, JAN, L). */const looksEnglish = (text: string) => (text.match(/[a-z]+/gi) ?? ([] as string[])).some((w) => !NAMES.has(w.toUpperCase()) && !/^\d*L$/i.test(w));function relative(ms: number) {  const min = Math.round(ms / 60000);  if (min < 1) return "in under a minute";  if (min < 60) return `in ${min} min`;  const h = Math.round(min / 60);  if (h < 36) return `in ${h} h`;  const d = Math.round(h / 24);  if (d < 14) return `in ${d} days`;  if (d < 60) return `in ${Math.round(d / 7)} weeks`;  const mo = Math.round(d / 30.4);  if (mo < 24) return `in ${mo} months`;  return `in ${Math.round(d / 365)} years`;}function zoneOffset(timeZone: string) {  try {    const part = new Intl.DateTimeFormat("en-US", { timeZone, timeZoneName: "shortOffset" }).formatToParts(new Date()).find((p) => p.type === "timeZoneName");    return part?.value.replace("GMT", "UTC") ?? "";  } catch {    return "";  }}const cityOf = (tz: string) => (tz === "UTC" ? "UTC" : (tz.split("/").pop() ?? tz).replace(/_/g, " "));/** A sentence that changes crossfades whole: the old one lifts away through a blur while the new one rises in. */function Line({ text, reduced }: { text: string; reduced: boolean }) {  const [shown, setShown] = React.useState({ text, key: 0 });  const [leaving, setLeaving] = React.useState<{ text: string; key: number }[]>([]);  if (text !== shown.text) {    if (shown.text && !reduced) setLeaving((l) => [...l.slice(-2), shown]);    setShown({ text, key: shown.key + 1 });  }  return (    <span className="relative block">      <span        key={shown.key}        className="block"        ref={(el) => {          if (!el || reduced || shown.key === 0 || el.dataset.in) return;          el.dataset.in = "1";          el.animate(            [              { opacity: 0, transform: "translateY(0.3em)", filter: "blur(4px)" },              { opacity: 1, transform: "none", filter: "blur(0px)" },            ],            { duration: 380, delay: 60, easing: EASE, fill: "backwards" },          );        }}      >        {shown.text || " "}      </span>      {leaving.map((l) => (        <span          key={l.key}          aria-hidden="true"          className="pointer-events-none absolute inset-x-0 top-0 block"          ref={(el) => {            if (!el || el.dataset.out) return;            el.dataset.out = "1";            el.animate(              [                { opacity: 1, transform: "none", filter: "blur(0px)" },                { opacity: 0, transform: "translateY(-0.3em)", filter: "blur(4px)" },              ],              { duration: 180, easing: EASE, fill: "forwards" },            ).onfinish = () => setLeaving((all) => all.filter((x) => x.key !== l.key));          }}        >          {l.text}        </span>      ))}    </span>  );}/** The expression on its way from one text to another: TextMorph, started from what the field showed. */function MorphOnce({ from, to, onDone }: { from: string; to: string; onDone: () => void }) {  const [text, setText] = React.useState(from);  React.useEffect(() => {    let inner = 0;    const outer = requestAnimationFrame(() => (inner = requestAnimationFrame(() => setText(to))));    const timer = window.setTimeout(onDone, 820);    return () => {      cancelAnimationFrame(outer);      cancelAnimationFrame(inner);      window.clearTimeout(timer);    };  }, [to, onDone]);  return (    <TextMorph animateWidth={false} className="whitespace-pre">      {text}    </TextMorph>  );}export function CronInput({  value,  defaultValue = "0 9 * * 1-5",  onValueChange,  timeZone,  defaultTimeZone = "UTC",  timeZones,  onTimeZoneChange,  runs: runCount = 5,  presets = CRON_PRESETS,  english = true,  hour12 = false,  label = "Schedule",  locales,  disabled = false,  name,  className = "",  ...props}: CronInputProps) {  const uid = React.useId();  const reduced = useReducedMotion();  // A default written in English starts as those words, already read as cron.  const [own, setOwn] = React.useState(() => (parseCron(defaultValue).ok || !english ? tidy(defaultValue) : (parseSchedule(defaultValue) ?? tidy(defaultValue))));  const committed = value !== undefined ? tidy(value) : own;  const [text, setText] = React.useState(() => (value !== undefined ? tidy(value) : defaultValue.trim()));  const [ownZone, setOwnZone] = React.useState(defaultTimeZone);  const zone = timeZone ?? ownZone;  const [caret, setCaret] = React.useState<number | null>(null);  const [focused, setFocused] = React.useState(false);  const [morph, setMorph] = React.useState<{ from: string; to: string; key: number } | null>(null);  const [marks, setMarks] = React.useState<{ x: number; w: number }[]>([]);  const [labelX, setLabelX] = React.useState<number[]>([]);  const [now, setNow] = React.useState<Date | null>(null);  const [announce, setAnnounce] = React.useState("");  const [presetMark, setPresetMark] = React.useState({ x: 0, w: 0, on: false, slide: false });  const inputRef = React.useRef<HTMLInputElement>(null);  const labelRefs = React.useRef<(HTMLSpanElement | null)[]>([]);  const labelRow = React.useRef<HTMLDivElement>(null);  const mirrorRef = React.useRef<HTMLSpanElement>(null);  const presetRefs = React.useRef<(HTMLButtonElement | null)[]>([]);  const [morphSeq, setMorphSeq] = React.useState(0);  const [lastGood, setLastGood] = React.useState<CronSchedule | null>(null);  // What the text means: cron, English that reads as cron, or a problem with a part to point at.  const read = React.useMemo(() => {    const cron = parseCron(text);    if (cron.ok) return { kind: "cron" as const, schedule: cron.schedule };    if (english && looksEnglish(text)) {      const converted = parseSchedule(text);      const parsed = converted ? parseCron(converted) : null;      if (parsed?.ok) return { kind: "english" as const, schedule: parsed.schedule };      return { kind: "error" as const, message: "Couldn’t read that. Try “every weekday at 9am” or cron like 0 9 * * 1-5.", field: null as number | null };    }    const bad = cron as Extract<CronParse, { ok: false }>;    return { kind: "error" as const, message: bad.message, field: bad.field };  }, [text, english]);  const schedule = read.kind === "error" ? null : read.schedule;  if (schedule && lastGood !== schedule) {    setLastGood(schedule);  }  const shownSchedule = schedule ?? lastGood;  // A new value from outside morphs in.  const [seen, setSeen] = React.useState(committed);  if (committed !== seen) {    setSeen(committed);    if (tidy(text) !== committed) {      const nextKey = morphSeq + 1;      setMorphSeq(nextKey);      if (!reduced) setMorph({ from: text, to: committed, key: nextKey });      setText(committed);    }  }  // Each valid cron expression is passed on as it's typed.  if (value === undefined && read.kind === "cron" && read.schedule.expression !== own) {    setOwn(read.schedule.expression);    setSeen(read.schedule.expression);  }  React.useEffect(() => {    if (read.kind === "cron" && read.schedule.expression !== committed) {      onValueChange?.(read.schedule.expression, read.schedule);    }  }, [read, committed, onValueChange]);  const morphTo = (next: string) => {    if (!reduced && next !== text) {      setMorphSeq((k) => {        const nextKey = k + 1;        setMorph((m) => ({ from: m ? m.to : text, to: next, key: nextKey }));        return nextKey;      });    }    setText(next);  };  const morphDone = React.useCallback(() => setMorph(null), []);  // English becomes cron on Enter or when you leave the field.  const settle = () => {    if (read.kind === "english") {      morphTo(read.schedule.expression);      setAnnounce(`Set to ${read.schedule.expression}: ${describeCron(read.schedule, { hour12 })}`);    }  };  // The clock for "in 3 h", re-read on each new minute (and only after mount, so the server's render matches).  React.useEffect(() => {    let timer = 0;    const tick = () => {      setNow(new Date());      timer = window.setTimeout(tick, 60_000 - (Date.now() % 60_000) + 50);    };    tick();    return () => window.clearTimeout(timer);  }, []);  const upcoming = React.useMemo(() => (shownSchedule && now && runCount ? nextRuns(shownSchedule, { from: now, count: runCount, timeZone: zone }) : []), [shownSchedule, now, runCount, zone]);  // Where each part sits in the field, measured from a copy of the text in the same type.  const tokens = React.useMemo(() => (read.kind === "english" ? [] : cronTokens(text)), [read.kind, text]);  React.useLayoutEffect(() => {    const mirror = mirrorRef.current;    const input = inputRef.current;    const node = mirror?.firstChild;    if (!mirror || !input) return;    const base = mirror.getBoundingClientRect().left;    const next = tokens.slice(0, 6).map((t) => {      if (!node) return { x: 0, w: 0 };      const range = document.createRange();      range.setStart(node, Math.min(t.start, node.textContent!.length));      range.setEnd(node, Math.min(t.end, node.textContent!.length));      const r = range.getBoundingClientRect();      return { x: r.left - base - input.scrollLeft, w: r.width };    });    setMarks((prev) => (prev.length === next.length && prev.every((p, i) => Math.abs(p.x - next[i].x) < 0.5 && Math.abs(p.w - next[i].w) < 0.5) ? prev : next));  }, [tokens]);  // Each name sits centred under its part, nudged along so none overlap or run past the edges.  React.useLayoutEffect(() => {    const row = labelRow.current;    if (!row) return;    const ws = FIELD_LABELS.map((_, i) => labelRefs.current[i]?.offsetWidth ?? 0);    const xs = FIELD_LABELS.map((_, i) => (marks[i] ? marks[i].x + marks[i].w / 2 - ws[i] / 2 : 0));    const n = Math.min(marks.length, FIELD_LABELS.length);    for (let i = 0; i < n; i++) xs[i] = Math.max(xs[i], i ? xs[i - 1] + ws[i - 1] + 8 : 0);    for (let i = n - 1; i >= 0; i--) xs[i] = Math.min(xs[i], i === n - 1 ? row.offsetWidth - ws[i] : xs[i + 1] - 8 - ws[i]);    setLabelX((prev) => (prev.length === xs.length && prev.every((x, i) => Math.abs(x - xs[i]) < 0.5) ? prev : xs));  }, [marks]);  const activeField = caret === null || !focused ? -1 : tokens.findIndex((t) => caret >= t.start && caret <= t.end);  const badField = read.kind === "error" ? read.field : null;  const underline = badField !== null && badField < marks.length ? badField : activeField;  // The highlight slides to the preset the schedule matches.  const presetIndex = schedule ? presets.findIndex((p) => tidy(p.expression) === schedule.expression) : -1;  React.useLayoutEffect(() => {    const el = presetRefs.current[presetIndex];    setPresetMark((m) => (el ? (m.x === el.offsetLeft && m.w === el.offsetWidth && m.on ? m : { x: el.offsetLeft, w: el.offsetWidth, on: true, slide: m.on }) : m.on ? { ...m, on: false, slide: false } : m));  }, [presetIndex, presets]);  // The meaning, said once typing settles.  const sentence = schedule ? describeCron(schedule, { hour12 }) : "";  React.useEffect(() => {    if (!focused) return;    const t = window.setTimeout(() => setAnnounce(read.kind === "error" ? read.message : sentence), 900);    return () => window.clearTimeout(t);  }, [sentence, read, focused]);  const lineText =    read.kind === "error" ? read.message : read.kind === "english" ? `${sentence}. Press Enter to use ${read.schedule.expression}` : sentence;  const dateFmt = React.useMemo(() => new Intl.DateTimeFormat(locales ?? "en-GB", { weekday: "short", day: "numeric", month: "short", timeZone: "UTC" }), [locales]);  const yearFmt = React.useMemo(() => new Intl.DateTimeFormat(locales ?? "en-GB", { weekday: "short", day: "numeric", month: "short", year: "numeric", timeZone: "UTC" }), [locales]);  const zoneOptions = React.useMemo(() => (timeZones ?? []).map((tz) => ({ value: tz, label: cityOf(tz), description: `${tz} · ${zoneOffset(tz)}` })), [timeZones]);  const nowYear = now?.getUTCFullYear();  const errorTone = "text-red-600 dark:text-red-400";  return (    <div className={`w-full text-foreground ${className}`} {...props}>      {presets.length > 0 && (        <div          role="group"          aria-label="Presets"          className="relative -mx-1 mb-2.5 flex gap-1 overflow-x-auto px-1 pb-0.5 [mask-image:linear-gradient(to_right,transparent,black_6px,black_calc(100%_-_20px),transparent)] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"        >          <span            aria-hidden="true"            className="pointer-events-none absolute left-0 top-0 h-7 rounded-full bg-accent shadow-[inset_0_0_0_1px_var(--border)]"            style={{              width: presetMark.w,              transform: `translateX(${presetMark.x}px)`,              opacity: presetMark.on ? 1 : 0,              transition: reduced ? "none" : `${presetMark.slide ? `transform 380ms ${EASE}, width 380ms ${EASE}, ` : ""}opacity 200ms ${EASE}`,            }}          />          {presets.map((p, i) => (            <button              key={p.expression}              ref={(el) => {                presetRefs.current[i] = el;              }}              type="button"              disabled={disabled}              aria-pressed={i === presetIndex}              onClick={() => {                morphTo(tidy(p.expression));                inputRef.current?.focus({ preventScroll: true });              }}              className={`relative h-7 shrink-0 cursor-pointer whitespace-nowrap rounded-full px-2.5 text-[12px] font-medium transition-colors duration-200 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 disabled:cursor-default ${                i === presetIndex ? "text-foreground" : "text-muted-foreground"              }`}            >              {p.label}            </button>          ))}        </div>      )}      <div        onMouseDown={(e) => {          if ((e.target as HTMLElement).closest("button, input")) return;          e.preventDefault();          inputRef.current?.focus();        }}        className={`rounded-[14px] border bg-background px-3 pb-1.5 pt-2 transition-[border-color] duration-200 ${disabled ? "opacity-60" : "cursor-text"}`}        style={{          borderColor:            read.kind === "error" && !focused              ? "color-mix(in oklab, #ef4444 45%, var(--border))"              : focused                ? "color-mix(in oklab, var(--ring) 55%, var(--border))"                : "var(--border)",        }}      >        <div className="flex items-center gap-2">          <div className="relative min-w-0 flex-1">            <input              ref={inputRef}              value={text}              disabled={disabled}              aria-label={label}              aria-invalid={read.kind === "error" || undefined}              aria-describedby={`${uid}-line`}              autoComplete="off"              autoCapitalize="off"              spellCheck={false}              onChange={(e) => {                setText(e.target.value);                setCaret(e.target.selectionStart);              }}              onSelect={(e) => setCaret(e.currentTarget.selectionStart)}              onFocus={() => setFocused(true)}              onBlur={() => {                setFocused(false);                settle();              }}              onKeyDown={(e) => {                if (e.key === "Enter") {                  e.preventDefault();                  settle();                } else if (e.key === "Escape" && tidy(text) !== committed) {                  e.preventDefault();                  e.stopPropagation();                  morphTo(committed);                }              }}              placeholder="0 9 * * 1-5"              className={`h-8 w-full min-w-0 bg-transparent outline-none placeholder:text-muted-foreground disabled:cursor-default ${TYPE}`}              style={{ wordSpacing: read.kind === "english" ? "normal" : "1.1em", color: morph ? "transparent" : undefined, caretColor: morph ? "var(--foreground)" : undefined }}            />            {/* A copy of the text in the same type, measured to place each part's name under it. */}            <span              ref={mirrorRef}              aria-hidden="true"              className={`pointer-events-none invisible absolute left-0 top-0 whitespace-pre ${TYPE}`}              style={{ wordSpacing: read.kind === "english" ? "normal" : "1.1em" }}            >              {text}            </span>            {morph && (              <span aria-hidden="true" className={`pointer-events-none absolute inset-y-0 left-0 flex items-center whitespace-pre ${TYPE}`} style={{ wordSpacing: "1.1em" }}>                <MorphOnce key={morph.key} from={morph.from} to={morph.to} onDone={morphDone} />              </span>            )}            {/* The part you're in, or the part at fault: a hairline that glides from part to part. */}            <span              aria-hidden="true"              className={`pointer-events-none absolute -bottom-px left-0 h-px ${badField !== null ? "bg-red-500" : "bg-primary"}`}              style={{                width: marks[underline]?.w ?? 0,                transform: `translateX(${marks[underline]?.x ?? 0}px)`,                opacity: underline >= 0 && marks[underline] && !morph ? 1 : 0,                transition: reduced ? "none" : `transform 300ms ${EASE}, width 300ms ${EASE}, opacity 200ms ${EASE}`,              }}            />          </div>          {zoneOptions.length > 1 ? (            <PillSelect              label="Time zone"              options={zoneOptions}              value={zone}              align="end"              width={250}              display={(o) => o?.label ?? cityOf(zone)}              onValueChange={(tz) => {                if (timeZone === undefined) setOwnZone(tz);                onTimeZoneChange?.(tz);              }}            />          ) : (            <span className="shrink-0 text-[12px] font-medium text-muted-foreground">{cityOf(zone)}</span>          )}        </div>        {/* The name of each part, under it; folds away while you write in English. */}        <div className="grid" style={{ gridTemplateRows: read.kind === "english" ? "0fr" : "1fr", transition: reduced ? "none" : `grid-template-rows 320ms ${EASE}` }}>          <div className="min-h-0 overflow-hidden">            <div ref={labelRow} aria-hidden="true" className="relative mt-0.5 h-4 text-[10.5px] leading-4">              {FIELD_LABELS.map((name, i) => {                const m = marks[i];                const tone = badField === i ? errorTone : activeField === i ? "text-foreground" : "text-muted-foreground";                return (                  <span                    key={name}                    ref={(el) => {                      labelRefs.current[i] = el;                    }}                    className={`absolute left-0 top-0 whitespace-nowrap transition-colors duration-200 ${tone}`}                    style={{                      transform: `translateX(${labelX[i] ?? i * 48}px)`,                      opacity: m && read.kind !== "english" ? 1 : 0,                      transition: reduced ? "none" : `transform 340ms ${EASE}, opacity 200ms ${EASE}, color 200ms`,                    }}                  >                    {name}                  </span>                );              })}            </div>          </div>        </div>      </div>      <p id={`${uid}-line`} className={`mt-2 min-h-[1.45em] pl-1 text-[12.5px] leading-[1.45] transition-colors duration-300 ${read.kind === "error" ? errorTone : "text-muted-foreground"}`}>        <Line text={lineText} reduced={reduced} />      </p>      {runCount > 0 && (        <div className="mt-3 border-t border-border pt-3">          <div className="flex items-baseline justify-between gap-3 text-[11.5px] text-muted-foreground">            <span className="font-medium">Next runs</span>            <span className="truncate">              {zone === "UTC" ? "Times in UTC" : `Times in ${cityOf(zone)} · ${zoneOffset(zone)}`}            </span>          </div>          {now && upcoming.length === 0 && shownSchedule && (            <p className={`mt-2 text-[12.5px] ${errorTone}`}>This never runs: no date in the next six years matches it.</p>          )}          <ol            aria-label="Next runs"            className="mt-1.5 transition-opacity duration-300"            style={{ opacity: schedule ? 1 : 0.45, transitionTimingFunction: EASE }}          >            {upcoming.map((r, i) => {              const w = r.wall;              const dayDate = new Date(Date.UTC(w.year, w.month - 1, w.day));              const day = (w.year === nowYear ? dateFmt : yearFmt).format(dayDate);              const h = hour12 ? w.hour % 12 || 12 : w.hour;              const note = r.skipped                ? `Clocks go forward that night: ${String(w.hour).padStart(2, "0")}:${String(w.minute).padStart(2, "0")} doesn’t happen in ${cityOf(zone)}.`                : r.repeated                  ? `Clocks go back that night: ${String(w.hour).padStart(2, "0")}:${String(w.minute).padStart(2, "0")} happens twice in ${cityOf(zone)}.`                  : null;              return (                <li key={i} className="border-b border-border/60 py-1.5 last:border-b-0">                  <span className="sr-only">                    {day}, {String(w.hour).padStart(2, "0")}:{String(w.minute).padStart(2, "0")}, {now ? relative(r.at.getTime() - now.getTime()) : ""}                    {note ? `. ${note}` : ""}                  </span>                  <span aria-hidden="true" className="flex items-baseline gap-3 text-[13px]">                    <span className="w-[6.5rem] shrink-0">                      <TextMorph>{day}</TextMorph>                    </span>                    <span className="inline-flex font-medium tabular-nums">                      <NumberRoll value={h} format={hour12 ? undefined : { minimumIntegerDigits: 2 }} duration={700} />                      <span>:</span>                      <NumberRoll value={w.minute} format={{ minimumIntegerDigits: 2 }} duration={700} />                      {hour12 && <TextMorph className="ml-0.5">{w.hour < 12 ? "am" : "pm"}</TextMorph>}                    </span>                    {note && (                      <svg viewBox="0 0 16 16" fill="none" className="size-3.5 shrink-0 self-center text-amber-600 dark:text-amber-400">                        <circle cx="8" cy="8" r="6.25" stroke="currentColor" strokeWidth="1.5" />                        <path d="M8 4.75v3.75" stroke="currentColor" strokeWidth="1.75" strokeLinecap="round" />                        <circle cx="8" cy="11" r="1" fill="currentColor" />                      </svg>                    )}                    <span className="ml-auto truncate text-[12px] text-muted-foreground">                      <TextMorph>{now ? relative(r.at.getTime() - now.getTime()) : ""}</TextMorph>                    </span>                  </span>                  {note && <span className="mt-0.5 block text-[11.5px] leading-snug text-amber-700 dark:text-amber-400">{note}</span>}                </li>              );            })}          </ol>        </div>      )}      {name && <input type="hidden" name={name} value={committed} />}      <span className="sr-only" role="status" aria-live="polite">        {announce}      </span>    </div>  );}export { describeCron, nextRuns, parseCron, parseSchedule };export type { CronSchedule };export { CRON_FIELDS };

Registry item: /r/cron-input.json