# CronInput — SvelteKit UI

Package: sveltekit-ui 1.1.94

Page: https://www.sveltekit-ui.com/components/cron_input

Category: Input controls

provides a popover-based UI for setting a cron expression (minute, hour, day-of-month, month, and day-of-week)

Public component import: `CronInput`

Public manager import: `create_cron_input_manager`

## Usage

```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>
```

## Configuration

### `val`

- type: string
- default: null
- description: the raw cron expression

### `label`

- type: string
- default: null
- description: optional label displayed next to the cron input

### `is_disabled`

- type: boolean
- default: false
- description: disables the input if true

### `is_nullable`

- type: boolean
- default: true
- description: allows the cron to be null if true

### `is_compressed`

- type: boolean
- default: true
- description: if true, sets button styling to compressed

### `is_popover`

- type: boolean
- default: true
- description: if true, opens the cron input in a popover

### `ml`

- type: number
- default: 0
- description: margin-left in rem

### `mr`

- type: number
- default: 0
- description: margin-right in rem

### `mt`

- type: number
- default: 0
- description: margin-top in rem

### `mb`

- type: number
- default: 0
- description: margin-bottom in rem

### `on_finish`

- type: function
- default: null
- description: callback triggered when the user clicks 'finish', receives the validated cron

## Methods

### `init()`

- description: initializes the manager, sets up internal text input, popover, and control buttons
- parameters:
  - config: object
- returns: void

### `finish_cron()`

- description: calls on_finish with the current cron value if provided, then closes the popover
- parameters:
- returns: void

### `set_attributes()`

- description: updates the manager’s config attributes (label, disabled, etc.)
- parameters:
  - input: object
- returns: void

## Returned state

### `id`

- type: string
- description: unique identifier for this cron input instance

### `label`

- type: string
- description: optional label displayed next to the input

### `val`

- type: string
- description: cleaned, fully formed cron expression or null

### `is_nullable`

- type: boolean
- description: allows the cron to be null if true

### `description`

- type: string
- description: english-like description of the cron schedule

### `is_disabled`

- type: boolean
- description: disables the input if true

### `is_compressed`

- type: boolean
- description: styles the button in a compressed manner if true

### `is_valid`

- type: boolean
- description: indicates if the provided cron expression is valid

### `is_popover`

- type: boolean
- description: if true, the cron input is displayed in a popover

### `ml`

- type: number
- description: margin-left in rem

### `mr`

- type: number
- description: margin-right in rem

### `mt`

- type: number
- description: margin-top in rem

### `mb`

- type: number
- description: margin-bottom in rem

### `popover_manager`

- type: object
- description: popover manager controlling the dropdown panel

### `popover_toggle_button_manager`

- type: object
- description: button manager used to open/close the popover

### `finish_button_manager`

- type: object
- description: button manager that finalizes the selected cron

### `cron_text_input_manager`

- type: object
- description: text input manager for editing the raw cron expression
