Skip to main content

Cron field

A cron expression field with presets, a plain-English description and the next runs.

<mm-cron-field name="schedule" label="Schedule" value="0 2 * * *"></mm-cron-field>

Guidance​

Cron fields set a schedule, as on the pipeline schedule step. Pick a preset (Hourly, Daily at 02:00, Weekly on Monday) or choose Custom and type a five-field expression in mono. The helper line says what the expression means in words ("Every day at 02:00 UTC"), syntax errors say exactly what to fix, and the next five run times are listed in UTC so there is no doubt about when a pipeline will run.

The presets are a radio group (https://www.w3.org/WAI/ARIA/apg/patterns/radio/): arrow keys move and select, Home and End jump to the ends, and Enter or Space on Custom moves focus to the expression. In the expression, Enter commits the value.

Properties​

PropertyAttributeTypeDefaultDescription
valuevaluestring''The cron expression, five fields or a macro such as @daily.
placeholderplaceholderstring'0 2 * * *'
hidePresetshide-presetsbooleanfalseHides the preset radio group.
runCountrun-countnumber5Number of upcoming runs listed.
nownowstring | number | Date | undefinedReference time for upcoming runs (ISO string, Date or epoch ms). Defaults to the current time.
descriptionstringThe expression in words, or '' when it is invalid.
labellabelstring''Field label. Rendered above the control unless hide-label, and always the accessible name.
helphelpstring''Help text under the control.
errorerrorstring''Error text: a sentence saying what to fix. Shows the crimson border, an icon and sets aria-invalid.
hideLabelhide-labelbooleanfalseHides the label visually; it stays the accessible name.
optionaloptionalbooleanfalseMarks the field as optional, in words.
namenamestring''Name submitted with the form.
disableddisabledbooleanfalseDisables the control and excludes it from submission.
requiredrequiredbooleanfalseRequires a value before the form submits.
formHTMLFormElement | null
validityValidityState
validationMessagestring
willValidateboolean
isDisabledbooleanTrue when disabled directly or by a disabled ancestor fieldset.

Methods​

MethodDescription
formResetCallback()Restore the initial value when the owning form resets.

Events​

EventDetailDescription
mm-inputCustomEvent<{ value: string }>On every keystroke in the expression.
mm-changeCustomEvent<CronChangeDetail>When the value is committed: a preset is chosen, Enter is pressed or the field loses focus after an edit.
changeEventNative change event, re-dispatched from the host on commit.
inputInputEvent

CSS parts​

PartDescription
presetsThe preset radio group.
controlThe bordered input wrapper.
inputThe native text input.
descriptionThe description line.
runsThe list of upcoming runs.

Examples​

Every state of mm-cron-field in Storybook, with keyboard and screen reader tests.