Skip to content

Time Field

Edit and validate a timezone-free wall-clock time.

Usage

Wall clock

Edit a timezone-free hour and minute value.

Selected time9:30 AM

Stepped

Accept values only at the configured interval.

Selected time9:30 AM

Controlled

Let the parent own the current value and apply accepted changes back to the component.

Selected time9:30 AM

API

Vue package: @sectile/vue/temporal/time-field

Components
  • TimeField

Props

TimeFieldProps

defaultValue

Initial value used when the component owns its state.

disabled

Whether interaction is unavailable.

label

Accessible name announced for the control.

modelValue

Current value when state is controlled by the parent.

native

Whether to use the browser native date or time input UI.

policies

Behavior policies that customize validation, movement, or selection.

readonly

Whether the value can be inspected but not changed.

required

Whether the control must contain a valid value before submission.

Other types

TimeValue

ts
type TimeValue = NonNullable<TimeFieldOptions['value']>

TimeFieldValueChangeHandler

ts
type TimeFieldValueChangeHandler = (value: TimeValue | null) => void

Parts

Shared scope: [data-scope="time-field"]. Combine it with a part selector to keep styles local to this component.

PartSelectorRoleExtra attributes
input[data-part="input"]Accepts the editable value or draft.

Keyboard interaction

KeyBehavior
Arrow Up / Arrow DownIncrement or decrement the active value segment.
EnterCommit the draft value.
EscapeCancel the draft and restore the accepted value.

Accessibility

The labeled input preserves native text entry while exposing time validation as one value.

Released under the MIT License.