Keyboard shortcut: Ctrl + K
Get started

Time input

VTimeInput offers typed time entry, a clock picker or a searchable list. The model always uses 24-hour HH:mm values.

Usage

vue
<script setup lang="ts">
import { ref } from 'vue'
import { VTimeInput } from 'vectis-ui'

const time = ref<string | null>(null)
</script>

<template>
  <VTimeInput v-model="time" label="Start time" />
</template>

Examples

Label, hint and icon

Name the field with label and add help text with hint.

vue

Type it or pick it from the clock

The glyph that opens the clock is yours to choose

Loading…

An icon at the start, a spinner at the end while something loads

<script setup lang="ts">
import { ref } from 'vue'
import { VTimeInput } from 'vectis-ui'
import { expand_more as expandMore, search } from 'vectis-ui/icons'

const start = ref<string | null>('09:15')
const meeting = ref<string | null>(null)
</script>

<template>
  <div class="column">
    <VTimeInput
      v-model="start"
      label="Start time"
      hint="Type it or pick it from the clock"
      show-picker
    />

    <VTimeInput
      v-model="meeting"
      label="Meeting"
      hint="The glyph that opens the clock is yours to choose"
      mode="picker"
      :picker-icon="expandMore"
    />

    <VTimeInput
      v-model="start"
      label="Filter by time"
      hint="An icon at the start, a spinner at the end while something loads"
      :icon-start="search"
      loading
    />
  </div>
</template>

<style scoped>
.column {
  display: flex;
  flex-direction: column;
  gap: var(--vectis-space-5);
  max-inline-size: 26rem;
}
</style>

Sizes

size sets the field size.

vue
<script setup lang="ts">
import { ref } from 'vue'
import { VTimeInput } from 'vectis-ui'

const rows = ref(
  (['sm', 'md', 'lg'] as const).map((size) => ({
    key: size,
    size,
    label: size,
    time: '09:15' as string | null,
  })),
)
</script>

<template>
  <div class="column">
    <VTimeInput
      v-for="row in rows"
      :key="row.key"
      v-model="row.time"
      :size="row.size"
      :label="row.label"
      show-picker
    />
  </div>
</template>

<style scoped>
.column {
  display: flex;
  flex-direction: column;
  gap: var(--vectis-space-5);
  max-inline-size: 26rem;
}
</style>

Modes

input allows typing, with an optional clock through showPicker. picker uses the clock alone. list offers searchable time options.

vue

No icon, no panel: the mask is the whole control

showPicker adds the icon and the panel it opens

Nothing can be typed, so the clock is the only way in

Every half hour, found by typing rather than by scrolling

<script setup lang="ts">
import { ref } from 'vue'
import { VTimeInput } from 'vectis-ui'

const typed = ref<string | null>('09:15')
const withPicker = ref<string | null>('09:15')
const readOnly = ref<string | null>('09:15')
const fromList = ref<string | null>('09:30')
</script>

<template>
  <div class="column">
    <VTimeInput
      v-model="typed"
      label="Typed, the default"
      hint="No icon, no panel: the mask is the whole control"
    />

    <VTimeInput
      v-model="withPicker"
      show-picker
      label="Typed, with the clock"
      hint="showPicker adds the icon and the panel it opens"
    />

    <VTimeInput
      v-model="readOnly"
      mode="picker"
      label="Read-only"
      hint="Nothing can be typed, so the clock is the only way in"
    />

    <VTimeInput
      v-model="fromList"
      mode="list"
      :minute-step="30"
      label="List"
      hint="Every half hour, found by typing rather than by scrolling"
    />
  </div>
</template>

<style scoped>
.column {
  display: flex;
  flex-direction: column;
  gap: var(--vectis-space-5);
  max-inline-size: 26rem;
}
</style>

Steps

minuteStep sets the clock step and list interval. It does not restrict typed minutes. Choose a larger step to shorten the list.

vue

The face offers four minutes an hour, and the arrow keys move by the same step

The step is what the rows are cut at: 48 of them here rather than 1440

The mask still takes any time; the step drives the clock and the arrow keys

<script setup lang="ts">
import { ref } from 'vue'
import { VTimeInput } from 'vectis-ui'

const appointment = ref<string | null>('14:15')
const slot = ref<string | null>('09:30')
const typed = ref<string | null>('08:00')
</script>

<template>
  <div class="column">
    <VTimeInput
      v-model="appointment"
      mode="picker"
      :minute-step="15"
      label="Quarter hours, on the clock"
      hint="The face offers four minutes an hour, and the arrow keys move by the same step"
    />

    <VTimeInput
      v-model="slot"
      mode="list"
      :minute-step="30"
      label="Half hours, as a list"
      hint="The step is what the rows are cut at: 48 of them here rather than 1440"
    />

    <VTimeInput
      v-model="typed"
      show-picker
      :minute-step="5"
      label="Five minutes, typed"
      hint="The mask still takes any time; the step drives the clock and the arrow keys"
    />
  </div>
</template>

<style scoped>
.column {
  display: flex;
  flex-direction: column;
  gap: var(--vectis-space-5);
  max-inline-size: 26rem;
}
</style>

What may be chosen

min, max, allowedHours and allowedMinutes restrict clock and list choices. A typed time outside these limits updates the model but fails native field validation.

vue

Type 08:00 and leave the field: the value stands and the field turns invalid

The rows outside the bounds are not offered at all

The face prints only the hours it can take

<script setup lang="ts">
import { ref } from 'vue'
import { VTimeInput } from 'vectis-ui'

const typed = ref<string | null>('09:30')
const listed = ref<string | null>('09:30')
const picked = ref<string | null>('09:30')
</script>

<template>
  <div class="column">
    <VTimeInput
      v-model="typed"
      format="24h"
      min="09:00"
      max="17:00"
      label="Typed"
      hint="Type 08:00 and leave the field: the value stands and the field turns invalid"
    />

    <VTimeInput
      v-model="listed"
      mode="list"
      format="24h"
      :minute-step="30"
      min="09:00"
      max="17:00"
      label="List"
      hint="The rows outside the bounds are not offered at all"
    />

    <VTimeInput
      v-model="picked"
      mode="picker"
      format="24h"
      :minute-step="30"
      min="09:00"
      max="17:00"
      label="Clock"
      hint="The face prints only the hours it can take"
    />
  </div>
</template>

<style scoped>
.column {
  display: flex;
  flex-direction: column;
  gap: var(--vectis-space-5);
  max-inline-size: 26rem;
}
</style>

Clearable

clearable adds a button to reset the time.

vue

The cross sits to the left of the clock icon, never in its place

Emptying the field is then the reader's own business

Here the cross is the combobox's own, chevron included

<script setup lang="ts">
import { ref } from 'vue'
import { VTimeInput } from 'vectis-ui'

const withCross = ref<string | null>('09:15')
const withoutCross = ref<string | null>('09:15')
const inList = ref<string | null>('09:30')
</script>

<template>
  <div class="column">
    <VTimeInput
      v-model="withCross"
      clearable
      show-picker
      label="Clearable"
      hint="The cross sits to the left of the clock icon, never in its place"
    />

    <VTimeInput
      v-model="withoutCross"
      show-picker
      label="Not clearable, the default"
      hint="Emptying the field is then the reader's own business"
    />

    <VTimeInput
      v-model="inList"
      clearable
      mode="list"
      :minute-step="30"
      label="Clearable, as a list"
      hint="Here the cross is the combobox's own, chevron included"
    />
  </div>
</template>

<style scoped>
.column {
  display: flex;
  flex-direction: column;
  gap: var(--vectis-space-5);
  max-inline-size: 26rem;
}
</style>

States

readonly prevents all value changes while preserving focus. loading shows a spinner without disabling interaction.

vue

For a rule the browser cannot check by itself

Greyed through the colour tokens, and the panel can no longer be opened

No typing, no clock, no clear cross

<script setup lang="ts">
import { ref } from 'vue'
import { VTimeInput } from 'vectis-ui'

const invalid = ref<string | null>('09:15')
</script>

<template>
  <div class="column">
    <VTimeInput
      v-model="invalid"
      invalid
      show-picker
      label="Invalid"
      hint="For a rule the browser cannot check by itself"
    />

    <VTimeInput
      model-value="09:15"
      disabled
      show-picker
      label="Disabled, with a value"
      hint="Greyed through the colour tokens, and the panel can no longer be opened"
    />

    <VTimeInput model-value="09:15" disabled mode="picker" label="Disabled, picker only" />

    <VTimeInput
      model-value="09:15"
      readonly
      show-picker
      clearable
      label="Read-only"
      hint="No typing, no clock, no clear cross"
    />

    <VTimeInput
      model-value="09:30"
      disabled
      mode="list"
      :minute-step="30"
      label="Disabled, as a list"
    />
  </div>
</template>

<style scoped>
.column {
  display: flex;
  flex-direction: column;
  gap: var(--vectis-space-5);
  max-inline-size: 26rem;
}
</style>

Twelve-hour clock

format="12h" displays AM/PM controls. The model remains a 24-hour time.

vue

The mask says nothing about the half of the day, so a button in the field does

Here the pair belongs to the clock, beside its two large numerals

Every row spells its own half of the day, so neither control is needed

07:00, 19:00, 19:30
<script setup lang="ts">
import { ref } from 'vue'
import { VTimeInput } from 'vectis-ui'

const typed = ref<string | null>('07:00')
const onTheClock = ref<string | null>('19:00')
const fromList = ref<string | null>('19:30')
</script>

<template>
  <div class="column">
    <VTimeInput
      v-model="typed"
      format="12h"
      show-picker
      label="Typed"
      hint="The mask says nothing about the half of the day, so a button in the field does"
    />

    <VTimeInput
      v-model="onTheClock"
      format="12h"
      mode="picker"
      label="Read-only"
      hint="Here the pair belongs to the clock, beside its two large numerals"
    />

    <VTimeInput
      v-model="fromList"
      format="12h"
      mode="list"
      :minute-step="30"
      label="List"
      hint="Every row spells its own half of the day, so neither control is needed"
    />

    <output class="value" aria-label="The three values held">
      {{ typed }}, {{ onTheClock }}, {{ fromList }}
    </output>
  </div>
</template>

<style scoped>
.column {
  display: flex;
  flex-direction: column;
  gap: var(--vectis-space-5);
  max-inline-size: 26rem;
}
.value {
  font-family: var(--vectis-text-family-code);
  font-size: var(--vectis-text-body-sm-size);
  color: var(--vectis-color-text-muted);
}
</style>

Localization

locale sets time display conventions. An explicit format overrides its hour cycle.

vue

format overrides what the tag would have chosen

<script setup lang="ts">
import { ref } from 'vue'
import { VTimeInput } from 'vectis-ui'

const locales = ref([
  { tag: 'en-US', label: 'en-US, twelve hours', time: '19:30' },
  { tag: 'en-GB', label: 'en-GB, the same words on a 24-hour clock', time: '19:30' },
  { tag: 'fr-FR', label: 'fr-FR', time: '19:30' },
  { tag: 'ja-JP', label: 'ja-JP', time: '19:30' },
])

const forced = ref<string | null>('19:30')
</script>

<template>
  <div class="column">
    <VTimeInput
      v-for="locale in locales"
      :key="locale.tag"
      v-model="locale.time"
      :locale="locale.tag"
      :label="locale.label"
      show-picker
    />

    <VTimeInput
      v-model="forced"
      locale="en-US"
      format="24h"
      show-picker
      label="en-US, forced onto a 24-hour clock"
      hint="format overrides what the tag would have chosen"
    />
  </div>
</template>

<style scoped>
.column {
  display: flex;
  flex-direction: column;
  gap: var(--vectis-space-5);
  max-inline-size: 26rem;
}
</style>

Placement

placement sets the preferred panel position.

vue
<script setup lang="ts">
import { ref } from 'vue'
import { VTimeInput } from 'vectis-ui'

const placements = ['bottom-start', 'bottom-end', 'top-start', 'top-end'] as const

const times = ref<Record<string, string | null>>({
  'bottom-start': '09:15',
  'bottom-end': '09:15',
  'top-start': '09:15',
  'top-end': '09:15',
})
</script>

<template>
  <div class="grid">
    <VTimeInput
      v-for="placement in placements"
      :key="placement"
      v-model="times[placement]"
      :placement="placement"
      :label="placement"
      mode="picker"
    />
  </div>
</template>

<style scoped>
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: var(--vectis-space-5);
  max-inline-size: 26rem;
}
</style>

API

Props

PropTypeDefault
formatTimePickerFormat'12h' | '24h'none
12- or 24-hour display. Defaults to the locale; the model always uses 24 hours.
modeTimeInputMode'picker' | 'input' | 'list''input'
Typed input, clock-only picker or searchable time list.
showPickerbooleanfalse
Adds a clock to input mode. Picker mode always includes it; list mode ignores it.
minuteStepnumber1
Clock step and list interval in minutes. Does not restrict typed values.
minstringnone
Earliest allowed time, inclusive, in HH:mm format.
maxstringnone
Latest allowed time, inclusive, in HH:mm format.
allowedHoursTimePickerAllowednone
Allowed hours: an array or predicate receiving a 24-hour value.
allowedMinutesTimePickerAllowednone
Allowed minutes: an array or predicate.
localestringnone
BCP 47 locale for time display. Overrides the global locale; format takes precedence.
labelstringnone
Visible label. Without a visible name, provide aria-label or aria-labelledby.
hintstringnone
Help text linked through aria-describedby.
errorstringnone
Error message shown in place of the hint. Sets aria-invalid, is linked through aria-describedby and is announced when it appears.
requiredbooleanfalse
Adds an asterisk after the label and passes required to the field.
hideLabelbooleanfalse
Hides the label visually while keeping it as the accessible name.
labelPositionFieldLabelPosition'top' | 'start''top'
Places the label above the field or beside it.
placeholderstringnone
Placeholder shown when the field is empty.
sizeTimeInputSize'sm' | 'md' | 'lg''md'
Component size.
disabledbooleanfalse
Disables interaction.
readonlybooleanfalse
Prevents typing, panel selection, AM/PM changes and clearing. Preserves focus.
invalidbooleanfalse
Sets aria-invalid and the error style. Does not block form submission by itself.
iconStartIconSourcenone
Start icon. A @click:icon-start listener makes it a button; provide iconStartLabel.
iconStartLabelstringnone
Accessible name of the start icon button.
pickerLabelstringnone
Accessible name of the clock button. Defaults to the library dictionary.
loadingbooleanfalse
Replaces the clock icon with a spinner without disabling the field.
loadingTextstringnone
Loading text and accessible spinner name. Defaults to the library dictionary.
clearablebooleanfalse
Adds a button to reset the value.
clearLabelstringnone
Accessible name of the clear button. Defaults to the library dictionary.
pickerIconIconSourceschedule
Clock button icon. Has no effect in list mode.
placementTimeInputPlacement'bottom' | 'bottom-start' | 'bottom-end' | 'top' | 'top-start' | 'top-end''bottom-start'
Preferred panel position relative to the field.
v-modelstring | nullnull
Time in 24-hour HH:mm format, or null.

Events

EventType
click:icon-start[event: MouseEvent]
The start icon button was clicked.
clear[]
The time was cleared; the model is already reset.

Slots

SlotType
start{}
Content after iconStart.
value-end{}
Content before the clear and picker buttons.
footerTimeInputFooterSlotProps
Replaces the clock’s Cancel and OK buttons. Call confirm to commit the draft, or cancel / close to discard it. Not rendered in list mode.

Types

Types used in the API tables. Import exported types from vectis-ui.

export interface BuiltinIcon {
  name: string
  paths: readonly [string] | readonly [string, string]
}
export type IconRender =
  | { path: string; viewBox?: string }
  | { component: Component; props?: Record<string, unknown> }
  | { src: string }
  | { text: string; class?: string }
  | { class: string }
export type IconSource = string | BuiltinIcon | IconRender
export interface TimeInputFooterSlotProps {
  confirm: () => void
  cancel: () => void
  close: () => void
}
export type TimePickerAllowed = number[] | ((value: number) => boolean)