Skip to content

Timepicker

The Timepicker input component allow users to select a time, and type the date directly into the input. The input opens a simple dropdown/modal for selecting a time, and uses the native timepicker for mobile. Use it with the Field component to access all the functionalities.

Examples

Base

Inline

To render the component inline instead of a dropdown/modal use the inline prop.

Min/Max date

Use the min-time and max-time props to define a limited time range for the user to choose from.

Footer Slot

The component has an additional footer slot for customization.

Granularity

To define the granularity of the hours, minutes and seconds to select from use the increment-hours, increment-minutes and increment-seconds props.

Timepicker component

An input with a simple dropdown/modal for selecting a time, uses native timepicker for mobile.

html
<o-timepicker></o-timepicker>

Props

Prop nameDescriptionTypeValuesDefault
activeThe active state of the dropdownboolean-false
ariaSelectHoursLabelAccessibility hours select aria labelstring-
From config:
timepicker: {
  ariaSelectHourLabel: "Select Hour"
}
ariaSelectMinutesLabelAccessibility minutes select aria labelstring-
From config:
timepicker: {
  ariaSelectMinuteLabel: "Select Minute"
}
ariaSelectSecondsLabelAccessibility seconds select aria labelstring-
From config:
timepicker: {
  ariaSelectSecondLabel: "Select Second"
}
closeOnClickClose dropdown on clickboolean-
From config:
timepicker: {
  closeOnClick: true
}
creatortime creator function, default is new Date()(() => Date)-
From config:
timepicker: {
  creator: undefined
}
customValidityCustom HTML 5 validation error to set on the form controlstring | ((currentValue: Date | null , state: ValidityState) => string) | undefined-""
defaultMinutesnumber-
defaultSecondsnumber-
desktopModalDropdown content is shown into a modal on desktopboolean-
From config:
timepicker: {
  desktopModal: false
}
disabledSame as native disabledboolean-false
enableSecondsboolean-false
expandedMakes input full width when inside a grouped or addon fieldboolean-false
formatterCustom function to format a date into a string((date: Date ) => string) | undefined-
From config:
timepicker: {
  formatter: undefined
}
hourFormat"12" | "24" | 12 | 24-
iconIcon to be shownstring-
From config:
timepicker: {
  icon: undefined
}
iconPackIcon pack to usestringmdi, fa, fas and any other custom icon pack
From config:
timepicker: {
  iconPack: undefined
}
iconRightIcon to be added on the right sidestring-
From config:
timepicker: {
  iconRight: undefined
}
iconRightClickableMake the icon right clickableboolean-false
incrementHoursnumber-1
incrementMinutesnumber-1
incrementSecondsnumber-1
inlineDisplay datepicker inlineboolean-false
localeDate format localestring-
From config:
{
  locale: undefined
}
maxTimeMax time to selectDate-
minTimeMin time to selectDate-
mobileBreakpointMobile breakpoint as max-width valuestring-
From config:
timepicker: {
  mobileBreakpoint: undefined
}
mobileModalDropdown content is shown into a modal on mobileboolean-
From config:
timepicker: {
  mobileModal: true
}
mobileNativeEnable mobile native input if mobile agentboolean-
From config:
timepicker: {
  mobileNative: true
}
v-modelThe input value stateDate-
openOnFocusOpen dropdown on focusboolean-
From config:
timepicker: {
  openOnFocus: true
}
overrideOverride existing theme classes completelyboolean-
parserCustom function to parse a string into a date((date: string) => Date ) | undefined-
From config:
timepicker: {
  parser: undefined
}
placeholderInput placeholderstring-
positionDropdown positionstring-
readonlySame as native input readonlyboolean-false
resetOnMeridianChangeReset the time inputs when meridian changesboolean-false
roundedMakes the input roundedboolean-false
sizeSize of the buttonstringsmall, medium, large
From config:
timepicker: {
  size: undefined
}
teleportAppend the component to another part of the DOM.
Set true to append the component to the body.
In addition, any CSS selector string or an actual DOM node can be used.
boolean | object | string-
From config:
timepicker: {
  teleport: false
}
unselectableTimesDefine a list of times which can not be selectedDate[] | ((date: Date) => boolean)-
useHtml5ValidationEnable HTML 5 native validationboolean-
From config:
{
  useHtml5Validation: true
}

Events

Event namePropertiesDescription
focusevent Event - native eventon input focus event
blurevent Event - native eventon input blur event
invalidevent Event - native eventon input invalid event
icon-clickevent Event - native eventon icon click event
icon-right-clickevent Event - native eventon icon right click event
update:model-valuevalue Date - updated modelValue propmodelValue prop two-way binding
update:activevalue boolean - updated active propactive prop two-way binding

Slots

NameDescriptionBindings
triggerOverride the trigger
footerDefine an additional content on footer

Class Inspector

Classes applied to the element:
Class propDescriptionPropsSuffixes
rootClassClass of the root element.
mobileClassClass of the root element when on mobile.
👉 Switch to mobile view to see it in action!
sizeClassClass of the root element with size.sizesmall
medium
large
boxClassClass of the dropdown box element where you choose the date.
separatorClassClass of the select separator element.
footerClassClass of the footer element.
inputClassClass to apply on the input element. More details here.
inputClassesClasses to apply on the internal input component. More details here.
dropdownClassClass to apply on the dropdown element. More details here.
dropdownClassesClasses to apply on the internal dropdown component. More details here.
selectClassesClasses to apply on the internal select component. More details here.

Sass variables

Current theme ➜ Oruga

SASS VariableDefault
$timepicker-font-sizevar(--#{$prefix}base-font-size)
$timepicker-box-line-heightvar(--#{$prefix}base-line-height)
$timepicker-box-padding0.375rem 1rem
$timepicker-footer-padding0 0.5rem
$timepicker-footer-margin0.875rem 0 0 0
$timepicker-select-line-heightvar(--#{$prefix}base-line-height)
$timepicker-select-padding$control-padding-vertical $control-padding-horizontal
$timepicker-select-color#363636
$timepicker-select-font-weight600
$timepicker-select-placeholder-opacityvar( --#{$prefix}base-disabled-opacity)
$timepicker-separator-font-weight600

See ➜ 📄 Full scss file

Current theme ➜ Bulma

The theme does not have any custom variables for this component.

Current theme ➜ Bootstrap

SASS VariableDefault
$timepicker-select-width4em

See ➜ 📄 Full scss file

Released under the MIT License.