Forms Core Stable

TimePicker

A field that opens a floating listbox of time slots generated at a configurable step, fully keyboard-navigable, with the highlighted slot always scrolled into view.

Preview

Installation

pnpm add fancy-ui-svelte
import { TimePicker } from 'fancy-ui-svelte'

Usage

svelte
<script lang="ts">
  import { TimePicker } from 'fancy-ui-svelte';
</script>

<TimePicker />

Examples

Basic Usage

Custom Step

15-minute slots instead of the default 30.

With Bounds

Restricted to business hours, 09:00 to 17:00.

Props

PropTypeDefaultDescription
value string | nullnullThe selected time, "HH:mm" 24-hour; bindable. hour12 changes display only.
onValueChange (value: string | null) => void-Called with the new value whenever a slot is picked.
step number30Minutes between generated slots.
min string-Earliest selectable slot ("HH:mm", inclusive).
max string-Latest selectable slot ("HH:mm", inclusive).
hour12 booleanfalseDisplay only — 12-hour clock with AM/PM. The value stays HH:mm either way.
disabled booleanfalseBlocks opening the panel; excludes the control from form submission.
required booleanfalseMarks the field required for the surrounding form.
invalid booleanfalseDrives the error border and aria-invalid.
id string-Element id.
name string-Native name. When set, a hidden input carries the HH:mm value.
label string-Accessible name — for a control with no visible Label next to it.
placeholder string"Select a time"Shown in the trigger while no time is selected.
locale string-BCP 47 locale for slot and trigger-label formatting.
class string-Additional CSS classes, merged onto the trigger button.
ref HTMLButtonElement | nullnullBindable reference to the trigger button.