Blocks / Schedule editor

Schedule editor

When it runs: every n minutes, hourly, daily, weekdays, monthly or cron, said in words.

import { ScheduleEditor, describeCron, nextRuns } from "@forgeron/ui";
/01 → Default
at
Weekdays at 08:00Europe/Paris0 8 * * 1-5
import { ScheduleEditor } from "@forgeron/ui";

export default function Default() {
  return (
    <div style={{ width: 340 }}>
      <ScheduleEditor
        defaultValue="0 8 * * 1-5"
        timezone="Europe/Paris"
        modes={["hours", "daily", "weekly", "cron"]}
      />
    </div>
  );
}
/02 → Next runs and timezone
at
Mondays, Wednesdays and Fridays at 07:30
Timezone
30 7 * * 1,3,5
  1. Fri 2026-11-20 07:30
  2. Mon 2026-11-23 07:30
  3. Wed 2026-11-25 07:30
  4. Fri 2026-11-27 07:30
import { ScheduleEditor } from "@forgeron/ui";
import { useState } from "react";

// `from` is now in the schedule's timezone, passed by the screen: the block never reads the clock.
export default function NextRunsAndTimezone() {
  const [cron, setCron] = useState("30 7 * * 1,3,5");
  const [tz, setTz] = useState("Europe/Paris");
  return (
    <div style={{ display: "grid", gap: 12, width: "100%", maxWidth: 520 }}>
      <ScheduleEditor
        value={cron}
        onChange={setCron}
        timezone={tz}
        timezones={["Europe/Paris", "Europe/London", "UTC", "America/New_York"]}
        onTimezoneChange={setTz}
        from="2026-11-18T10:00"
        preview={4}
      />
    </div>
  );
}
/03 → Cron
Every day at 09:00 and 17:00UTC
  1. Wed 2026-11-18 17:00
  2. Thu 2026-11-19 09:00
  3. Thu 2026-11-19 17:00
import { ScheduleEditor } from "@forgeron/ui";

// What no plain shape says stays cron, still said in words when it can be.
export default function Cron() {
  return (
    <div style={{ width: "100%", maxWidth: 520 }}>
      <ScheduleEditor defaultValue="0 9,17 * * *" timezone="UTC" from="2026-11-18T10:00" />
    </div>
  );
}
API → Props
PropTypeDefaultDescription
value / defaultValue / onChangestring—A cron expression.
timezonestring—Shown in the summary.
timezones / onTimezoneChangestring[] / (tz) => void—A picker next to the summary.
fromstring—Now, YYYY-MM-DDTHH:MM in the timezone: the next runs are listed after it.
previewnumber3How many next runs.
modesMode[]—The shapes offered, in order.
disabledboolean—Shown, not editable.
classNamestring—Extra classes.