Keyboard shortcut: Ctrl + K
Get started

Time picker

VTimePicker is an inline clock for selecting hours and minutes. Its model uses 24-hour HH:mm values.

Usage

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

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

<template>
  <VTimePicker v-model="time" />
</template>

Examples

Minute step

minuteStep sets the pointer and keyboard step. Only reachable minutes appear on the face.

vue
Every minute, the default
Quarter hours
<script setup lang="ts">
import { ref } from 'vue'
import { VTimePicker, VTypography } from 'vectis-ui'

const anyMinute = ref<string | null>('09:37')
const quarters = ref<string | null>('09:45')
</script>

<template>
  <div class="row">
    <div class="group">
      <VTypography variant="overline" tone="muted">Every minute, the default</VTypography>
      <VTimePicker v-model="anyMinute" />
    </div>

    <div class="group">
      <VTypography variant="overline" tone="muted">Quarter hours</VTypography>
      <VTimePicker v-model="quarters" :minute-step="15" />
    </div>
  </div>
</template>

<style scoped>
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--vectis-space-6);
}
.group {
  display: grid;
  gap: var(--vectis-space-2);
}
</style>

What may be chosen

Use time bounds and allowed-hour or allowed-minute rules to restrict choices. An hour is unavailable when it has no allowed minute.

vue
Between 09:30 and 17:00

Nine o'clock stays open, and it is its first thirty minutes that go

Quarter hours, on three hours

The face keeps only the five minute marks a rule leaves standing

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

const office = ref<string | null>('09:30')
const booking = ref<string | null>('14:15')
</script>

<template>
  <div class="row">
    <div class="group">
      <VTypography variant="overline" tone="muted">Between 09:30 and 17:00</VTypography>
      <VTimePicker v-model="office" format="24h" min="09:30" max="17:00" />
      <VTypography variant="caption" tone="muted">
        Nine o'clock stays open, and it is its first thirty minutes that go
      </VTypography>
    </div>

    <div class="group">
      <VTypography variant="overline" tone="muted">Quarter hours, on three hours</VTypography>
      <VTimePicker
        v-model="booking"
        format="24h"
        :minute-step="5"
        :allowed-hours="[9, 14, 16]"
        :allowed-minutes="(minute) => minute % 15 === 0"
      />
      <VTypography variant="caption" tone="muted">
        The face keeps only the five minute marks a rule leaves standing
      </VTypography>
    </div>
  </div>
</template>

<style scoped>
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--vectis-space-6);
}
.group {
  display: grid;
  gap: var(--vectis-space-2);
  max-inline-size: 20rem;
}
</style>

Hour format

12h shows one hour ring with AM/PM controls; 24h shows two rings. The model always uses 24 hours.

vue
format 12h
format 24h
<script setup lang="ts">
import { ref } from 'vue'
import { VTimePicker, VTypography } from 'vectis-ui'

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

<template>
  <div class="row">
    <div class="group">
      <VTypography variant="overline" tone="muted">format 12h</VTypography>
      <VTimePicker v-model="twelve" format="12h" />
    </div>

    <div class="group">
      <VTypography variant="overline" tone="muted">format 24h</VTypography>
      <VTimePicker v-model="twentyFour" format="24h" />
    </div>
  </div>
</template>

<style scoped>
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--vectis-space-6);
}
.group {
  display: grid;
  gap: var(--vectis-space-2);
}
</style>

Localization

The locale sets the hour cycle unless format overrides it.

vue
en-US, twelve hours
en-GB, twenty-four
ja-JP
<script setup lang="ts">
import { ref } from 'vue'
import { VTimePicker, VTypography } from 'vectis-ui'

const locales = ref<{ tag: string; caption: string; time: string | null }[]>([
  { tag: 'en-US', caption: 'en-US, twelve hours', time: '19:30' },
  { tag: 'en-GB', caption: 'en-GB, twenty-four', time: '19:30' },
  { tag: 'ja-JP', caption: 'ja-JP', time: '19:30' },
])
</script>

<template>
  <div class="row">
    <div v-for="locale in locales" :key="locale.tag" class="group">
      <VTypography variant="overline" tone="muted">{{ locale.caption }}</VTypography>
      <VTimePicker v-model="locale.time" :locale="locale.tag" />
    </div>
  </div>
</template>

<style scoped>
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--vectis-space-6);
}
.group {
  display: grid;
  gap: var(--vectis-space-2);
}
</style>

API

Props

PropTypeDefault
formatTimePickerFormat'12h' | '24h'none
12- or 24-hour display. Defaults to the locale; the model always uses 24 hours.
localestringnone
BCP 47 locale for time display. Overrides the global locale; format takes precedence.
minuteStepnumber1
Minute step for the clock and arrow keys.
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.
disabledbooleanfalse
Disables interaction.
readonlybooleanfalse
Prevents value changes. The face remains focusable and the hour/minute display can still be switched.
labelstringnone
Accessible name of the clock. Defaults to the dictionary; consumer aria-label takes precedence.
v-modelstring | nullnull
Time in 24-hour HH:mm format, or null. An empty clock shows midnight.

Events

EventType
confirm[value: string | null]
Keyboard confirmation of the minute selection. Receives the current time; releasing the pointer does not emit it.

Slots

SlotType
footer{}
Actions below the clock.

Types

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

export type TimePickerAllowed = number[] | ((value: number) => boolean)

CSS variables

TokenValue
--vectis-control-size-time-picker-dial16rem
--vectis-control-size-time-picker-number3rem
--vectis-control-size-time-picker-center0.5rem
--vectis-control-size-time-picker-hand2px
--vectis-control-size-time-picker-hand-minor1rem