WlTimePicker
Formatting
Selected: 09:30
Full example
<script setup lang="ts">
import { WlField, WlTimePicker } from "legato-ui";
import { ref } from "vue";
const value = ref<string | null>("09:30");
</script>
<template>
<div class="wl-stack" data-space="md">
<WlField
v-slot="field"
label="Meeting time"
hint="From 08:00 to 18:00. Clearing the field sets the model to null."
>
<WlTimePicker
:id="field.id"
v-model="value"
:aria-describedby="field.ariaDescribedby"
min-time="08:00"
max-time="18:00"
:hour-format="12"
:step="900"
:allowed-intervals="[{ start: '08:00', end: '12:00' }, { start: '13:00', end: '18:00' }]"
/>
</WlField>
<p class="wl-text-small" role="status">{{ "Selected:" }} {{ value ?? "no time set" }}</p>
</div>
</template>States
Selected: 09:30
Full example
<script setup lang="ts">
import { WlField, WlTimePicker } from "legato-ui";
import { ref } from "vue";
const value = ref<string | null>("09:30");
</script>
<template>
<div class="wl-stack" data-space="md">
<WlField
v-slot="field"
label="Meeting time"
hint="From 08:00 to 18:00. Clearing the field sets the model to null."
>
<WlTimePicker
:id="field.id"
v-model="value"
:aria-describedby="field.ariaDescribedby"
min-time="08:00"
max-time="18:00"
:hour-format="12"
:step="900"
:allowed-intervals="[{ start: '08:00', end: '12:00' }, { start: '13:00', end: '18:00' }]"
/>
</WlField>
<p class="wl-text-small" role="status">{{ "Selected:" }} {{ value ?? "no time set" }}</p>
</div>
</template>Time, limits and states
Three sizes, compact density, daytime and overnight ranges, error and clearing a nullable model.
Sizes and daytime range
Overnight range, error and disabled
The model is HH:mm or null, without a date or time zone. An empty field clears the model; an invalid time does not replace the last valid value.
Meeting: 09:30. Night shift: 23:30.
Full example
<script setup lang="ts">
import { WlButton, WlField, WlTimePicker } from "legato-ui";
import { ref } from "vue";
const appointment = ref<string | null>("09:30");
const night = ref<string | null>("23:30");
</script>
<template>
<div class="wl-stack" data-space="xl" data-input-example="WlTimePicker">
<section class="wl-stack" data-space="md">
<h3 class="wl-text-subheading">{{ "Sizes and daytime range" }}</h3>
<div class="wl-grid" data-space="lg">
<WlField
v-for="size in ['sm', 'md', 'lg'] as const"
:id="`docs-time-${size}`"
:key="size"
v-slot="{ id, ariaDescribedby }"
:label="`${'Meeting time, '}${size}`"
hint="From 08:00 to 18:00."
><WlTimePicker
:id="id"
v-model="appointment"
:size="size"
min-time="08:00"
max-time="18:00"
:aria-describedby="ariaDescribedby"
/></WlField>
<WlField id="docs-time-compact" v-slot="{ id }" label="Compact time"><WlTimePicker
:id="id"
v-model="appointment"
min-time="08:00"
max-time="18:00"
density="compact"
/></WlField>
</div>
</section>
<section class="wl-stack" data-space="md">
<h3 class="wl-text-subheading">{{ "Overnight range, error and disabled" }}</h3>
<div class="wl-grid" data-space="lg">
<WlField
id="docs-time-night"
v-slot="{ id, ariaDescribedby }"
label="Night shift"
hint="From 22:00 to 02:00: the range crosses midnight."
><WlTimePicker
:id="id"
v-model="night"
min-time="22:00"
max-time="02:00"
:aria-describedby="ariaDescribedby"
/></WlField>
<WlField
id="docs-time-required"
v-slot="{ id, ariaDescribedby, invalid, required }"
label="Required meeting time"
:error="appointment ? undefined : 'Enter a meeting time.'"
required
><WlTimePicker
:id="id"
v-model="appointment"
min-time="08:00"
max-time="18:00"
:invalid="invalid"
:required="required"
:aria-describedby="ariaDescribedby"
/></WlField>
<WlField id="docs-time-disabled" v-slot="{ id }" label="Unavailable time">
<WlTimePicker :id="id" model-value="10:00" disabled />
</WlField>
</div>
<p class="wl-text-small wl-text-muted">{{ "The model is HH:mm or null, without a date or time zone. An empty field clears the model; an invalid time does not replace the last valid value." }}</p>
<div class="wl-inline" data-space="sm">
<WlButton size="sm" @click="appointment = null; night = null">{{ "Clear time" }}</WlButton>
<WlButton size="sm" @click="appointment = '09:30'; night = '23:30'">{{ "Reset time" }}</WlButton>
</div>
<p class="wl-text-small" role="status">{{
"Meeting:"
}} {{
appointment ?? 'null'
}}{{
". Night shift:"
}} {{
night ?? 'null'
}}.</p>
</section>
</div>
</template>Props
Types, accepted values and literal defaults come from the public manifest. Inherited settings name their source; “Not set” means no default is declared.
v-model: string |HH:mm time or null (default null).
| Prop | Type / values | Default | Purpose |
|---|---|---|---|
minTime | string | Not set | Lower HH:mm boundary; minTime > maxTime defines an overnight range. |
maxTime | string | Not set | Upper HH:mm boundary. |
size | WlSizeSm | "md" | Field size. |
density | WlDensity | "default" | Density. |
disabled | boolean | false | Disables selection. |
invalid | boolean | false | External error state. |
pt | WlPt< | Not set | Root and input attributes. |
step | number | | 60 | Increment in seconds, or any for unrestricted step precision. |
hourFormat | WlTimePickerHourFormat | "auto" | Choose native, twelve-hour or twenty-four-hour time presentation. |
allowedIntervals | readonly WlTimeInterval[] | Not set | Allowed time intervals; values outside them cannot be selected. |
Events
| Event | Payload | When emitted |
|---|---|---|
update:modelValue | string | | Emitted when the component requests a model change; the payload is the next value. |
Slots
No public slots.
Pass-through: pt
Sections WlTimePicker are listed below. Attributes merge in this order: createWlPt() WlConfig.ptpt instance. Class and style merge; the last supplied value takes priority for other attributes.
| Section | DOM | Purpose |
|---|---|---|
root | div.wl-time-picker | The root section in WlConfig.pt.timepicker configuration. |
input | input.wl-input | The input section in WlConfig.pt.timepicker configuration. |
Sections refer to the component DOM. Dotted names identify a configuration group and its section; composite parts use their own pt groups. Global and local attributes merge, with class and style added together.
Keyboard and accessibility
- Associate a visible label with the native time input using id/for, or set aria-label. The browser controls time-selection keys and appearance.
- The model contains local HH:mm or null, without a date or time zone. minTime > maxTime indicates an overnight range.
- Pass application errors through invalid and text associated by aria-describedby. Range restrictions do not replace the error label.
- disabled disables native input; invalid time does not change the model's last valid value.
Keyboard and application responsibilities
Provide a meaningful accessible name and connect labels, hints and errors to the focusable element. Check the behavior with your own data and a screen reader.
WAI-ARIA Authoring PracticesChanges are emitted through v-model. After selection, cancellation and reset, labels and states must remain clear.
In your application, check keyboard controls, zoom and focus visibility. State labels and required information must be readable in every theme.