Time Input #
Time Input component is a combination of Time Picker and Input components. You can find usage examples using following links:
Examples #
Default #
AM PM #
VaTimeInput will automatically format input string if you need to use AM PM.
Clearable #
The clearable
prop adds a button to the right to clear the input. Prop clearableIcon
sets the custom clear icon.
Validation #
Validation works the same way as VaInput
validation, except rules functions should accept Date
instead of string.
Formatting #
We format input text specific to view
prop. You can pass custom format function that accepts Date and return string.
In example bellow (d) => d.toLocaleTimeString()
is used.
Parsing #
Default parse time function likely cover all of your needs, but you can provide your own parse function using parseTime
prop.
It can parse such inputs: 11, 11:00, 11:00:00, 11 pm, 23, 2300, 11.00, 11somejunk00
Props #
Name | Description | Types | Default |
---|---|---|---|
ampm | Use 12-hours time format. |
|
|
anchor |
| - | |
anchorSelector | Anchor CSS selector instead of passing slot |
|
|
ariaLabel | The aria-label of the component |
|
|
ariaResetLabel | The aria-label of the "reset" button |
|
|
ariaToggleDropdownLabel | The aria-label of the "toggle dropdown list" button |
|
|
autoPlacement | If dropdown doesn't fit viewport, it will be placed automatically to fit viewport |
|
|
background | The color name of the background color |
| - |
cellHeight | Height of the time cell |
|
|
clearable | Adds a button to reset the input field value |
|
|
clearableIcon | Sets the cleaning button icon. |
|
|
clearValue | Sets value that should be set after clearing |
|
|
closeOnAnchorClick | Dropdown will be closed when anchor is clicked |
|
|
closeOnChange |
|
| |
closeOnClickOutside | Dropdown will be closed when clicked outside dropdown content and anchor |
|
|
closeOnContentClick | Dropdown will be closed when clicked inside dropdown content |
|
|
closeOnFocusOutside |
|
| |
color | Sets input color |
|
|
contentClass |
|
| |
counter |
| - | |
cursor | Dropdown will be rendered relative to cursor position |
|
|
dirty | Sets the dirty state of the component |
|
|
disabled | Disable the input |
|
|
error | Sets input state to error |
| - |
errorCount | Number of error messages displayed |
|
|
errorMessages | Displays a list of error messages or message if using a string |
| - |
format | Custom function that format model value as input text |
| - |
framed | Adds borders to center of the picker |
|
|
hoursFilter | Function that allows you to hide some specific hours |
| - |
hoverOutTimeout | Time in |
|
|
hoverOverTimeout | Time in |
|
|
icon | Sets an icon. The default icon position is on the right |
|
|
immediateValidation | Sets the validation to be performed when the component is mounted |
|
|
innerLabel |
|
| |
inputAriaDescribedby |
| - | |
inputAriaLabel |
|
| |
inputAriaLabelledby |
| - | |
isContentHoverable | If true, dropdown content will be hoverable |
|
|
isOpen | Value for dropdown. If |
| - |
keepAnchorWidth | If true, dropdown content will have exact same width as anchor |
|
|
label | Sets input label |
|
|
leftIcon | Sets the icon position to the left. |
|
|
loading | Indicates that something is loading (spinner icon). |
|
|
manualInput | Allows user to manually input date in VaInput |
|
|
messages | Displays a list of messages or message if using a string |
|
|
minutesFilter | Function that allows you to hide some specific minutes |
| - |
modelValue | The value of the |
| - |
name | Applies |
| - |
offset | Dropdown content will be moved by main and cross axis according to current |
|
|
parse | Custom function that parses text from VaInput |
| - |
periodUpdatesModelValue | If user will change period it will automatically update model value. You can turn off it and am/pm switch will only change view. |
|
|
placeholder | Sets input placeholder |
|
|
placement | Sets the placement of the dropdown content. More about placements |
|
|
preset | Named preset combination of component props. |
| - |
readonly | Puts input in readonly state |
|
|
requiredMark | Adds required mark to the label |
|
|
role | Sets the |
|
|
rules | Accepts an array of functions that take an input value as an argument and return either true / false or a string with an error message |
|
|
secondsFilter | Function that allows you to hide some specific seconds |
| - |
stateful | Add possibility to work with component without setting |
|
|
stickToEdges | Dropdown will not be rendered outside of viewport. It will be moved in opposite direction. |
|
|
success | Sets input state to success |
|
|
target | Navigation target, More info here. |
| - |
teleport | Element where content will be rendered |
| - |
trigger | Action that will triggered when open and close dropdown. |
|
|
verticalScrollOnOverflow |
|
| |
view | View specifying which columns will be shown |
|
|
visibleCellsCount | Count of time cells to display |
|
|
Events #
Name | Description |
---|---|
blur | On blur. |
clear | |
focus | On focus. |
update:dirty | Fires when the dirty state changes |
update:error | Fires when the error state changes |
update:errorMessages | Fires when the error messages change |
update:isOpen | |
update:modelValue | The event is triggered when the component needs to change the model. Is also used by |
Slots #
Name | Description |
---|---|
append | |
appendInner | |
prepend | |
prependInner |