Live preview

Interactive example

Loading example…

Usage

Import the component and its manager, then make it your own.

ComponentCronInput
Managercreate_cron_input_manager

svelte

<script>
  // Import the shared stylesheet once in your application's root layout.
  import "sveltekit-ui/style.css"
  import { CronInput, create_cron_input_manager } from "sveltekit-ui"

  const manager = create_cron_input_manager({
    label: "Run every weekday at 9 AM",
    val: "0 9 * * 1-5",
    is_nullable: false,
    is_popover: true,
  })
</script>

<CronInput {manager} />
<p>Cron expression: {manager.val}</p>

API reference

Configure the manager, call its methods, and read its reactive state.

11 entries in configuration

PropertyTypeDefaultDescription
valstring nullthe raw cron expression
labelstring nulloptional label displayed next to the cron input
is_disabledboolean falsedisables the input if true
is_nullableboolean trueallows the cron to be null if true
is_compressedboolean trueif true, sets button styling to compressed
is_popoverboolean trueif true, opens the cron input in a popover
mlnumber 0margin-left in rem
mrnumber 0margin-right in rem
mtnumber 0margin-top in rem
mbnumber 0margin-bottom in rem
on_finishfunction nullcallback triggered when the user clicks 'finish', receives the validated cron