Cron Builder

Free

A visual cron / schedule builder: every N minutes, hourly, daily, weekly and monthly modes on a segmented control, or a Custom field for any five-field expression, validated as you type. A plain-language preview ("Every weekday at 09:00") and the next runs in any time zone. The value is the normalised expression; the parse, format, describe and next-runs helpers are exported.

</>sv-cron-builder cronscheduleschedulerrecurrencecrontabjobintervaltime zoneform control
import { SvCronBuilderComponent } from '@styloviz/forms/cron-builder';

Demo & usage

Basic usage

Usage example — open the gallery for the full interactive demo.

An interactive demo for this component lives in the gallery.

Open live demo

More examples

Two-way binding

example.htmlAngular
<sv-cron-builder label="Daily digest email" [(value)]="schedule" />

readonly schedule = signal('30 6 * * *'); // "Every day at 06:30"

Reactive forms — invalid while the expression is

example.htmlAngular
<sv-cron-builder label="Backup window" [formControl]="schedule" timeZone="Europe/London" />

readonly schedule = new FormControl('0 2 * * 0', { nonNullable: true });
// Typing "0 25 * * *" in Custom: schedule.value stays '0 2 * * 0',
// schedule.errors → { cron: { code: 'range', field: 'hour', token: '25', min: 0, max: 23 } }

Next runs in a time zone

example.htmlAngular
<sv-cron-builder [(value)]="schedule" timeZone="America/New_York" [nextRunCount]="5" />

The helpers, without the component

example.htmlAngular
import { svDescribeCron, svNextCronRuns, svParseCron } from '@styloviz/forms';

svParseCron('0 9 * * MON-FRI');   // { ok: true, cron, expression: '0 9 * * 1-5' }
svParseCron('61 * * * *');        // { ok: false, error: { code: 'range', field: 'minute', token: '61', min: 0, max: 59 } }
svDescribeCron('30 6 1,15 * *', { locale: 'en-GB' }); // 'On the 1st and 15th of every month at 06:30'
svDescribeCron('0 0 1 * 1', { locale: 'en-GB' });     // 'At 00:00, on the 1st of the month, or on any Monday'
svNextCronRuns('0 9 * * 1-5', { count: 3, timeZone: 'Asia/Dhaka' }); // Date[]

Signal Forms

Bind it with `[formField]` from `@angular/forms/signals` — the control is a ControlValueAccessor, which Signal Forms drives on Angular 21 and 22 alike.

cron-builder.signal-forms.tsTypeScript
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
import { FormField, form, required } from '@angular/forms/signals';
import { SvCronBuilderComponent } from '@styloviz/forms/cron-builder';

@Component({
  selector: 'app-cron-builder-signal-forms',
  standalone: true,
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [FormField, SvCronBuilderComponent],
  template: `
    <sv-cron-builder [formField]="job.schedule" label="Report schedule" timeZone="Europe/London" />
    <p>Schedule: {{ job.schedule().value() }} · valid: {{ job.schedule().valid() }}</p>
  `,
})
export class CronBuilderSignalFormsExample {
  readonly model = signal({ schedule: '0 9 * * 1-5' });
  readonly job = form(this.model, (path) => {
    required(path.schedule);
  });
}

When to use

  • Letting users schedule reports, syncs, backups, reminders or any recurring job in an admin panel or internal tool.
  • Showing a stored cron expression in words, with its next runs, so nobody has to decode `*/15 9-17 * * 1-5` by eye.
  • Use `sv-time-picker` instead for a single time of day, and `sv-date-picker` for a single date.

Compare with

  • Time Picker — Time Picker holds one wall-clock time. Cron Builder holds a repeating schedule — every N minutes, hourly, daily, weekly, monthly or any five-field cron expression — and says in words when it runs.

Async states

None — this component has nothing to load, so it has no loading, empty or error state to drive.

Inputs

NameTypeDefaultDescription
valuestring (two-way)''The cron expression (five fields). Two-way: `[(value)]`. Only a valid expression is ever written back, in its normalised numeric form; `''` means no schedule yet.
labelstring | nullnullVisible group label. Null uses the `cronLegend` label ("Schedule").
timeZonestring | nullnullIANA time zone the schedule runs in, for the next-runs preview. Null uses the browser's.
nextRunCountnumber3How many upcoming runs the preview lists, 0–10. 0 hides the list.
showPreviewbooleantrueShow the sentence and next runs under the editor.
localestringsvLocale()BCP 47 locale for weekday and month names, times and the sentence.
disabledbooleanfalseDisable every control.
errorMessagestring''Client-side validation message from the host, shown when the builder has none of its own.
serverErrorSvServerErrornullA rejection reported by the server about this value. Self-expires when the value changes.
labelsPartial<SvCronBuilderLabels>{}Per-instance text, merged over the registry's `forms` labels.

Outputs

EventPayload typeDescription
errorChangeSvCronError | nullThe builder's own validation result changed: the parse error (or "choose at least one day") on screen, or `null` once it is valid again. While it is non-null `value` is not updated.
valueChangestringEmits the new `value` whenever it changes — the output half of `[(value)]`.

Customization & theming

  • Six modes: `minutes` (every 1, 2, 3, 4, 5, 6, 10, 12, 15, 20 or 30 minutes), `hourly` (a minute past every 1, 2, 3, 4, 6, 8 or 12 hours), `daily`, `weekly` (any weekdays), `monthly` (any days of the month) and `custom`. An expression the visual modes cannot show — `*/7`, a month, both day fields, a list of hours — opens in Custom.
  • Custom accepts `*`, values, ranges `1-5`, steps `*/15`, `1-30/5`, `a/n`, lists, month and weekday names (`JAN`, `mon`) and `@hourly` / `@daily` / `@weekly` / `@monthly` / `@yearly`; the value is written back normalised.
  • The preview is `svDescribeCron` in the kit's locale — weekday and month names, times, ordinals and lists come from `Intl` — and `nextRunCount` runs (3 by default, 0 hides them) from `svNextCronRuns`. `showPreview` turns the whole preview off.
  • Every string comes from the `forms` labels (`cron*` keys, plus `hour` and `minute`) — `provideSvLabels(SV_FORMS_LABELS_DE)` or the per-instance `labels` input.
  • Mode switch, toggles and focus rings use the `primary-*` tokens and the invalid border the `danger-*` tokens, so a remapped theme recolours the builder.

Forms integration

  • sv-cron-builder — ControlValueAccessor.[formControl], formControlName, [(ngModel)] and Signal Forms [formField] all work.

Best practices

  • Do: Store the emitted value: it is already the normalised numeric form (`0 9 * * 1-5`, never `MON-FRI` or `7` for Sunday), so equal schedules compare equal.
  • Do: Pass the `timeZone` your scheduler runs in. The next runs are read in that zone, so they match what the server will actually do.
  • Don't: Don't assume both day fields are AND-ed: `0 0 1 * 1` runs on the 1st AND on every Monday. The preview says so in words; only a field written with `*` (`*/2`) makes cron require both.
  • Tip: Bind `[formControl]` to get validation for free: the control is invalid with `errors.cron` while the expression on screen is, and keeps the last valid value.

Accessibility

  • The builder is a `<fieldset>` named by its `label`; the mode switch is the kit's segmented control as a `radiogroup` named "Frequency", operated with the arrow keys.
  • Intervals, hours and minutes are native `<select>`s with visible labels; weekdays and days of the month are native checkboxes in their own named `<fieldset>`, each target at least 36 px.
  • An invalid Custom expression sets `aria-invalid` and adds the error to `aria-describedby` beside the format hint; the message names the field and the rejected text, in a `role="alert"`. "Choose at least one day" is described on the day group the same way.
  • The sentence for the schedule is a polite live region, so a screen reader hears "Every weekday at 09:00" as the controls change; runs are `<time datetime>` elements.
  • Implements ControlValueAccessor and Validator — `[(ngModel)]`, `[formControl]` and `formControlName` work, and `formControl.disable()` disables every control.

Feedback on Cron Builder

Spotted a gap in this page, or something that didn't work as described? Comments are GitHub Discussions in the public styloviz/community repo, so posting needs a GitHub account.

Loads giscus.app and GitHub — nothing is fetched until you click.