Skip to content

TimePicker

Use YhTimePicker to select or enter arbitrary points in time. It supports spinner panels, range selection, 12-hour formatting, disabled time rules, and footer actions.

TimePicker vs TimeSelect

  • TimePicker: Select any time through spinner panels.
  • TimeSelect: Pick from a predefined list of fixed time slots.

Basic Usage

Click the input to open the panel and choose hours, minutes, and seconds.

Current value: Not selected

Basic Usage

Disabled State

Use disabled to prevent interaction.

Disabled State

Clearable

Set clearable to show the clear icon when a value exists.

Current value: 09:15:30

Clearable

Different Sizes

Use size to switch between large, default, and small.

Different Sizes

12-Hour Format

Set use12-hours to render the displayed value with AM/PM formatting.

Current value: Not selected

12-Hour Format

Hide Seconds

Set show-seconds to false to keep only the hour and minute columns.

Current value: Not selected

Hide Seconds

Arrow Control Mode

Set arrow-control to switch the panel to up/down controls.

Arrow Control Mode

Step Settings

Use hour-step, minute-step, and second-step to control the available increments.

Hour step: 2, Minute step: 15, Second step: 30

Step Settings

Disabled Time

Use disabled-time to disable specific hours, minutes, or seconds.

Disabled: 00:00-05:59, 22:00-23:59, and specific minutes at 12:00

Disabled Time

Time Range Selection

Set is-range to select start and end times in the same control.

to

Current value: Not selected

Time Range Selection

Automatic Range Sorting

Set order-on-confirm to swap the range values automatically when the end time is earlier than the start time.

to

Current value: 10:00:00 - 08:00:00

Automatic Range Sorting

Full Feature Demo

This example combines clearable behavior, footer actions, and custom action labels.

Full Feature Demo

Use in Nuxt

After installing the YH-UI Nuxt module, YhTimePicker can be used directly. Inputs, initial values, and placeholders render during SSR, while popup positioning, panel scrolling, and imperative methods such as focus and open continue on the client after hydration.

Use in Nuxt

API

Props

NameDescriptionTypeDefault
model-value / v-modelBound valueYhTimePickerValue | YhTimePickerRangeValueundefined
disabledWhether the picker is disabledbooleanfalse
editableWhether the input is editablebooleantrue
clearableWhether the value can be clearedbooleantrue
sizeInput size'large' | 'default' | 'small'undefined
placeholderPlaceholder text in single modestring''
start-placeholderPlaceholder text for the start input in range modestring''
end-placeholderPlaceholder text for the end input in range modestring''
nameNative input namestringundefined
is-rangeWhether range mode is enabledbooleanfalse
formatDisplay formatstring'HH:mm:ss'
value-formatFormat used when emitting string values. Falls back to format when omittedstringundefined
prefix-iconDeclared prefix icon prop. The current template still renders the built-in clock icon and does not consume this propstring | Componentundefined
clear-iconDeclared clear icon prop. The current template still renders the built-in clear icon and does not consume this propstring | Componentundefined
use12-hoursWhether to use 12-hour formatbooleanfalse
show-secondsWhether the seconds column is shownbooleantrue
hour-stepHour step sizenumber1
minute-stepMinute step sizenumber1
second-stepSecond step sizenumber1
disabled-timeDisabled time configurationYhTimePickerDisabledTimeConfigundefined
popper-classCustom panel class namestringundefined
popper-styleDeclared panel style prop. The current implementation does not merge this prop into the popup stylesstring | Record<string, string>undefined
teleportedWhether the panel is teleported to bodybooleantrue
validate-eventWhether form validation runs on change and blurbooleantrue
popper-offsetOffset between the input and popup panelnumber4
range-separatorRange separator textstring'-'
default-valueInitial panel value used when the bound value is emptyYhTimePickerValue | YhTimePickerRangeValueundefined
hour-optionsCustom hour optionsnumber[]undefined
minute-optionsCustom minute optionsnumber[]undefined
second-optionsCustom second optionsnumber[]undefined
hide-on-blurWhether the panel closes on blurbooleantrue
confirm-textConfirm button label. Falls back to locale text when emptystring''
cancel-textCancel button label. Falls back to locale text when emptystring''
now-textNow button label. Falls back to locale text when emptystring''
show-footerWhether the footer action area is shownbooleantrue
show-nowWhether the now button is shown in the footerbooleantrue
arrow-controlWhether arrow control mode is enabledbooleanfalse
tabindexNative tabindex valuenumber | string0
idNative input id in single mode. Range mode does not apply this prop to the start/end inputsstringundefined
order-on-confirmWhether range values are auto-sorted on confirmbooleanfalse
theme-overridesComponent-level theme overridesComponentThemeVarsundefined

Events

NameDescriptionParameters
update:modelValueTriggered when the bound value updates(value: YhTimePickerValue | YhTimePickerRangeValue) => void
changeTriggered when the confirmed value changes(value: YhTimePickerValue | YhTimePickerRangeValue) => void
focusTriggered when the input gains focus(event: FocusEvent) => void
blurTriggered when the input loses focus(event: FocusEvent) => void
clearTriggered when the clear icon is clicked() => void
visible-changeTriggered when panel visibility changes(visible: boolean) => void
confirmTriggered when the confirm button is clicked(value: YhTimePickerValue | YhTimePickerRangeValue) => void
cancelTriggered when the cancel button is clicked() => void

Slots

NameDescriptionParameters
prefixContent rendered before the input-
suffixDeclared in the slot type, but the current template does not render this slot-
rangeSeparatorCustom range separator content-

Expose

NameDescriptionType
focusFocuses the input() => void
blurBlurs the input() => void
openOpens the panel() => void
closeCloses the panel() => void
inputRefRef to the single-mode input. In range mode it does not point to the start/end inputsRef<HTMLInputElement | undefined>

Type Exports

NameDescription
YhTimePickerPropsProps type for YhTimePicker
YhTimePickerEmitsEmits type for YhTimePicker
YhTimePickerSlotsSlots type for YhTimePicker
YhTimePickerExposePublic expose type for YhTimePicker
YhTimePickerSizeSize union type
YhTimePickerValueSingle time value type
YhTimePickerRangeValueTime range value type
YhTimePickerDisabledTimeConfigDisabled time configuration type
YhTimePickerStateInternal panel time state type
YhTimePickerInstanceComponent instance type

Theme Variables

YhTimePicker supports themeOverrides. The stylesheet directly consumes the following component-scoped CSS variables, while borders, shadows, and text colors continue to inherit shared theme tokens.

VariableDescriptionDefault
--yh-time-picker-widthWidth in single mode220px
--yh-time-picker-range-widthWidth in range mode360px
--yh-time-picker-active-colorActive item text colorvar(--yh-color-primary)
--yh-time-picker-active-bgActive item background colorvar(--yh-color-primary-light-9)
--yh-time-picker-hover-bgHover background color for spinner itemsvar(--yh-fill-color-light)
--yh-time-picker-panel-bgPopup panel background colorvar(--yh-bg-color)
--yh-time-picker-border-radiusPopup border radiusvar(--yh-radius-md)

Released under the MIT License.