Time Picker
A focused time picker component with scrollable hour and minute columns in 12-hour or 24-hour formats, designed to complement CalendarGrid for full date-time selection.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | required | The unique identifier for the component container. |
mode | 'hour' | 'minute' | 'second' | 'minute' | Time selection granularity mode ('hour', 'minute', or 'second'). |
selectedTime | string | '12:00' | The selected time string value. Supports $bindable. |
format | '12h' | '24h' | '24h' | Time format standard ('12h' or '24h'). |
stepMinuteInterval | number | 5 | Step minute interval increment (e.g., 1, 5, 10, 15, 30). |
stepSecondInterval | number | 5 | Step second interval increment when mode is 'second'. |
showHeader | boolean | true | Whether to display the header with the active time preview. |
variant | string | '' | User-defined variant name, added to the root element. Style it with a CSS rule that starts from the root. |
Samples
1. Hour Only Mode
Renders only the hour column for hourly scheduling or timeframe selection.
Hour
14
Selected Hour: 14:00
<script> import { TimePicker } from 'fluid-ui-svelte/components'; let selectedHour = $state('14');</script> <TimePicker id="time-picker-hour-only" mode="hour" bind:selectedTime={selectedHour}/>2. Standard Hour & Minute Mode
Select hours and minutes in 24-hour format with customizable minute intervals.
Time
14:30
Selected Time: 14:30
<script> import { TimePicker } from 'fluid-ui-svelte/components'; let selectedTime = $state('14:30');</script> <TimePicker id="time-picker-basic" mode="minute" bind:selectedTime/>3. Precise Seconds Mode
Includes an additional column for selecting exact seconds with custom intervals.
Time
14:30:45
Selected Time: 14:30:45
<script> import { TimePicker } from 'fluid-ui-svelte/components'; let selectedTime = $state('14:30:45');</script> <TimePicker id="time-picker-seconds" mode="second" stepSecondInterval={5} bind:selectedTime/>4. 12-Hour Format with AM / PM
Supports standard 12-hour period selection with dedicated AM and PM selector buttons.
Time
02:30 PM
Selected Time: 02:30 PM
<script> import { TimePicker } from 'fluid-ui-svelte/components'; let selectedTime = $state('02:30 PM');</script> <TimePicker id="time-picker-12h" format="12h" bind:selectedTime/>