CronInput
When something runs, as a cron expression with its meaning in words under it: «Every day at 03:00». Presets fill the common ones.
import { CronInput } from '@sypnia/ui/react'
On this page
A backup schedule
Every day at 03:00 · America/Bogota
Code
import { useState } from 'react';
import { CronInput, Field } from '@sypnia/ui/react';
// Choose a common schedule or write your own: the words under it follow.
export default function Schedule() {
const [cron, setCron] = useState('0 3 * * *');
return <Field label="Run the backup"><CronInput value={cron} onChange={setCron} timezone="America/Bogota" /></Field>;
} When to use it
Use it when
- Backups, reports, scheduled functions.
Do not use it when
- One-off times: use DateTimePicker.
For everyone
- The words under the field are read when they change; a mistake says what a schedule needs.
Props
| CronInput | Type | Default |
|---|---|---|
onChangerequired | (v: string) => void | |
valuerequired | string | |
aria-describedby | string | |
aria-labelThe name for screen readers when there is no Field around it. | string | |
aria-labelledby | string | |
className | string | |
disabled | boolean | |
idInside a Field it comes from the Field. | string | |
timezone | string |