Skip to content

Time Range Field

Edit start and end times while enforcing interval and order rules.

Usage

Office hours

Choose a start and end time constrained to ordinary office hours.

Office hours9:30 AM – 5:45 PM

Stepped

Accept values only at the configured interval.

Office hours9:30 AM – 5:45 PM

Controlled

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

Office hours9:30 AM – 5:45 PM

API

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

Components
  • TimeRangeFieldRoot
  • TimeRangeFieldStartInput
  • TimeRangeFieldEndInput

Props

TimeRangeFieldRootProps

as

Element or component rendered for this part.

asChild

Whether to merge this part into its single child instead of rendering a wrapper.

defaultValue

Initial value used when the component owns its state.

disabled

Whether interaction is unavailable.

endLabel

Accessible label for the range end input.

modelValue

Current value when state is controlled by the parent.

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.

startLabel

Accessible label for the range start input.

Slots

TimeRangeFieldRootSlotProps

active

Whether this item is currently active.

disabled

Whether interaction is unavailable.

endText

Formatted text for the range end value.

readonly

Whether the value can be inspected but not changed.

startText

Formatted text for the range start value.

value

Current value exposed by this contract.

Events

TimeRangeFieldRoot

update:modelValue

Emitted when the component requests a new controlled value.

Other types

TimeRangeFieldValueChangeHandler

ts
type TimeRangeFieldValueChangeHandler = (value: TimeRange | null) => void

TimeRange

NameTypeRequired
startTimeValueYes
endTimeValueYes

Parts

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

PartSelectorRoleExtra attributes
root[data-part="root"]Defines the component boundary and owns its composed parts.
start-input[data-part="start-input"]Edits the start value.
end-input[data-part="end-input"]Edits the end value.

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

Separate labeled start and end inputs expose one ordered time range and keep endpoint errors visible.

Released under the MIT License.