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.
<o-timepicker></o-timepicker>
Props
Prop name | Description | Type | Values | Default |
---|---|---|---|---|
active | The active state of the dropdown | boolean | - | false |
ariaSelectHoursLabel | Accessibility hours select aria label | string | - | From config: timepicker: { |
ariaSelectMinutesLabel | Accessibility minutes select aria label | string | - | From config: timepicker: { |
ariaSelectSecondsLabel | Accessibility seconds select aria label | string | - | From config: timepicker: { |
closeOnClick | Close dropdown on click | boolean | - | From config: timepicker: { |
creator | time creator function, default is new Date() | (() => Date) | - | From config: timepicker: { |
customValidity | Custom HTML 5 validation error to set on the form control | string | ((currentValue: Date | null , state: ValidityState) => string) | undefined | - | "" |
defaultMinutes | number | - | ||
defaultSeconds | number | - | ||
desktopModal | Dropdown content is shown into a modal on desktop | boolean | - | From config: timepicker: { |
disabled | Same as native disabled | boolean | - | false |
enableSeconds | boolean | - | false | |
expanded | Makes input full width when inside a grouped or addon field | boolean | - | false |
formatter | Custom function to format a date into a string | ((date: Date ) => string) | undefined | - | From config: timepicker: { |
hourFormat | "12" | "24" | 12 | 24 | - | ||
icon | Icon to be shown | string | - | From config: timepicker: { |
iconPack | Icon pack to use | string | mdi , fa , fas and any other custom icon pack | From config: timepicker: { |
iconRight | Icon to be added on the right side | string | - | From config: timepicker: { |
iconRightClickable | Make the icon right clickable | boolean | - | false |
incrementHours | number | - | 1 | |
incrementMinutes | number | - | 1 | |
incrementSeconds | number | - | 1 | |
inline | Display datepicker inline | boolean | - | false |
locale | Date format locale | string | - | From config: { |
maxTime | Max time to select | Date | - | |
minTime | Min time to select | Date | - | |
mobileBreakpoint | Mobile breakpoint as max-width value | string | - | From config: timepicker: { |
mobileModal | Dropdown content is shown into a modal on mobile | boolean | - | From config: timepicker: { |
mobileNative | Enable mobile native input if mobile agent | boolean | - | From config: timepicker: { |
v-model | The input value state | Date | - | |
openOnFocus | Open dropdown on focus | boolean | - | From config: timepicker: { |
override | Override existing theme classes completely | boolean | - | |
parser | Custom function to parse a string into a date | ((date: string) => Date ) | undefined | - | From config: timepicker: { |
placeholder | Input placeholder | string | - | |
position | Dropdown position | string | - | |
readonly | Same as native input readonly | boolean | - | false |
resetOnMeridianChange | Reset the time inputs when meridian changes | boolean | - | false |
rounded | Makes the input rounded | boolean | - | false |
size | Size of the button | string | small , medium , large | From config: timepicker: { |
teleport | Append 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: { |
unselectableTimes | Define a list of times which can not be selected | Date[] | ((date: Date) => boolean) | - | |
useHtml5Validation | Enable HTML 5 native validation | boolean | - | From config: { |
Events
Event name | Properties | Description |
---|---|---|
focus | event Event - native event | on input focus event |
blur | event Event - native event | on input blur event |
invalid | event Event - native event | on input invalid event |
icon-click | event Event - native event | on icon click event |
icon-right-click | event Event - native event | on icon right click event |
update:model-value | value Date - updated modelValue prop | modelValue prop two-way binding |
update:active | value boolean - updated active prop | active prop two-way binding |
Slots
Name | Description | Bindings |
---|---|---|
trigger | Override the trigger | |
footer | Define an additional content on footer |
Class Inspector
Class prop | Description | Props | Suffixes | |
---|---|---|---|---|
rootClass | Class of the root element. | |||
mobileClass | Class of the root element when on mobile. 👉 Switch to mobile view to see it in action! | |||
sizeClass | Class of the root element with size. | size | small | |
boxClass | Class of the dropdown box element where you choose the date. | |||
separatorClass | Class of the select separator element. | |||
footerClass | Class of the footer element. | |||
inputClass | Class to apply on the input element. More details here. | |||
inputClasses | Classes to apply on the internal input component. More details here. | |||
dropdownClass | Class to apply on the dropdown element. More details here. | |||
dropdownClasses | Classes to apply on the internal dropdown component. More details here. | |||
selectClasses | Classes to apply on the internal select component. More details here. |
Sass variables
Current theme ➜ Oruga
SASS Variable | Default |
---|---|
$timepicker-font-size | var(--#{$prefix}base-font-size) |
$timepicker-box-line-height | var(--#{$prefix}base-line-height) |
$timepicker-box-padding | 0.375rem 1rem |
$timepicker-footer-padding | 0 0.5rem |
$timepicker-footer-margin | 0.875rem 0 0 0 |
$timepicker-select-line-height | var(--#{$prefix}base-line-height) |
$timepicker-select-padding | $control-padding-vertical $control-padding-horizontal |
$timepicker-select-color | #363636 |
$timepicker-select-font-weight | 600 |
$timepicker-select-placeholder-opacity | var( --#{$prefix}base-disabled-opacity) |
$timepicker-separator-font-weight | 600 |
See ➜ 📄 Full scss file
Current theme ➜ Bulma
The theme does not have any custom variables for this component.