Skip to content

Time field ​

A field for the time of day.

The pickup point is open from 10 AM to 8 PM

The value is a string such as 09:30, with no time zone. The hour format and the order of the parts follow the app language.

Installation ​

ts
import { NuiTimeField } from '@numior/kit';

Usage ​

Add seconds and change the hour format, the minute step and the states of the field.

hourCycle
12- or 24-hour clock in place of the locale default.

Minute step in the picker and for PageUp and PageDown, such as 15.

size
Changes the size of the control: sm, md or lg. The theme density shifts the height of each size.

Label of the control. Inside NuiField the field provides the label.

Hint below the control. Screen readers announce it with the control.

Error text below the control. Puts the control into the error state.

Examples ​

Show the time in another language ​

Set locale.

Add seconds ​

Add seconds.

Order 20408 was handed to the courier

Behavior ​

Digits fill the parts one by one, and the caret moves to the next part once the current one is full. While any part is empty, the model is null.

A time before min or after max turns into the nearest limit when the focus leaves the field.

Accessibility ​

A screen reader names each part of the time, such as "hour" or "minute". Tab stops on one part only, and the left and right arrows move between the parts. The parts run left to right in right-to-left text too.

Keys
Action
↑
Increases the hours or minutes, wrapping past the maximum.
↓
Decreases the hours or minutes, wrapping past zero.
→
Moves from hours to minutes and on.
←
Moves back from minutes to hours.
PageUp
Moves the time forward by step minutes.
PageDown
Moves the time back by step minutes.
⌫
Clears the focused hours or minutes.
Alt↓
Opens the time picker.
↵
In the picker, confirms the time and closes.
Esc
Closes the time picker.

API ​

Props

Name
Type
Default
Description
seconds
boolean
false
Adds seconds. The value comes as HH:mm:ss.
hourCycle
HourCycle
—
12- or 24-hour clock in place of the locale default.
locale
string
—
Locale of the labels and time format, such as en-US. Defaults to the locale from createNuiConfig.
min
string
—
Earliest allowed time as HH:mm.
max
string
—
Latest allowed time as HH:mm.
step
number
15
Minute step in the picker and for PageUp and PageDown, such as 15.
name
string
—
Name the time is submitted with in a form.
placement
Placement
"bottom-start"
Side of the field the time picker opens on.
clockLabel
string
—
Clock button label for screen readers. Defaults to "Choose time" from the dictionary.
emptyLabel
string
—
Text shown when min and max leave no time to pick. Defaults to "No times".
id
string
—
Id of the control. Defaults to the one from NuiField or is generated automatically.
size
NuiSize
"md"
Changes the size of the control: sm, md or lg. The theme density shifts the height of each size.
disabled
boolean
—
Disables the control. Inside NuiField it defaults to the field value.
readonly
boolean
—
Prevents changes to the time. The value stays selectable and copyable.
required
boolean
—
Marks the control as required. Inside NuiField it defaults to the field value.
invalid
boolean
—
Shows the error state without a text. With error it turns on by itself.
label
string
—
Label of the control. Inside NuiField the field provides the label.
description
string
—
Hint below the control. Screen readers announce it with the control.
error
string
—
Error text below the control. Puts the control into the error state.
reserveError
boolean
false
Reserves space for the error so the form does not shift when it appears.

Models

Name
Type
Default
Description
v-model
string | null
null
Time as HH:mm without a time zone, or null.

Exposed

Name
Type
Description
focus
() => void
Focuses the field.

Texts

Key
Russian
English
clock
Выбрать время
Choose time
empty
Нет доступного времени
No times

Edit this page

Search

Esc