Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Buttons

  • Button
  • ShimmerButton
  • InteractiveHoverButton
  • RainbowButton
  • PulsatingButton
  • RippleButton
  • ButtonGroup
  • SocialButton

Basic Inputs

  • Input
  • Textarea
  • CellEditor
  • Select
  • Checkbox
  • CheckboxGroup
  • Radio
  • Switch
  • Toggle
  • Segmented
  • Slider
  • NumberField
  • ElasticSlider

Advanced Inputs

  • MathTextarea
  • QuestionEditor
  • QuestionAnswer
  • MathField
  • SecretField
  • PasswordGenerator
  • Combobox
  • RemoteSelect
  • Listbox
  • Mentions
  • InputOTP
  • Rating
  • Upload
  • RegionSelect
  • ImageCropper
  • ScopeMatrix
  • Transfer
  • Cascader
  • TreeSelect
  • RegionCascader
  • CountrySelect
  • MarkdownEditor
  • Novel editor
  • RichTextEditor
  • CodeEditor
  • IssueReporter
  • ColorPicker
  • ColorField
  • ColorSwatchPicker
  • Choicebox
  • EmojiPicker
  • VoiceRecord
  • IconPicker
  • InspectorPanel

Date and Time

  • Calendar
  • DatePicker
  • DateTimePicker
  • DateRangePicker
  • TimePicker
  • TimeField

Form Frameworks

  • Form
  • ModalForm / DrawerForm
  • ProForm
  • StepsForm
  • LoginForm
  • AuthPanel
  • ClickCaptcha
  • Label
  • Field
  • SearchForm

TimeField

time-field

Edits hour, minute, and optional second segments directly from the keyboard.

Usage

Basic usage

Each hour/minute is a segment, and you can record without taking your hands off the keyboard: ↑↓ to adjust the value, ←→ to cut into segments, overwrite directly with numbers (enter two digits to automatically jump to the next segment), and Backspace to clear segments. It is important to choose TimePicker.

09:30
tsx
<TimeField defaultValue="09:30" />

With seconds

withSeconds Add the second segment, and the shape of the external value becomes HH:mm:ss.

09:30:15
tsx
<TimeField withSeconds defaultValue="09:30:15" />

Limited optional range

minTime / maxTime is clamped at the moment when **the entire segment is lost** - segment level restrictions will make it impossible to lose "first lose 23 points and then lose minutes".

12:00
tsx
<TimeField defaultValue="12:00" minTime="09:30" maxTime="18:00" />

Size

size uses the same scale as Input and Select (sm 32px / md 40px / lg 48px), so controls sitting on one form row line up.

09:30
09:30
09:30
tsx
<TimeField size="sm" defaultValue="09:30" />
<TimeField size="md" defaultValue="09:30" />
<TimeField size="lg" defaultValue="09:30" />

Disabled / Read Only

disabled is grayed out as a whole and cannot be focused; readOnly cannot change the value but can be browsed in sections.

09:30
09:30
tsx
<TimeField defaultValue="09:30" disabled />
<TimeField defaultValue="09:30" readOnly />

When to use

Use TimeField in keyboard-heavy schedules, attendance forms, or bulk edits where many times are entered on one screen. Users can type 14 then 30 without opening a popup.

Use TimePicker for popup-based selection with minuteStep and a Now shortcut, or DateTimePicker when date and time are selected together.

Before 0.15.0 this component bridged to MUI X TimeField and required four optional peer dependencies plus MuiBridgeProvider. The current dependency-free implementation also supports min/max bounds and seconds.

Import

ts
import { TimeField } from "@hulianui/ui"

Props

NameTypeDefaultDescription
valuestring | null-Controlled value in zero-padded 24-hour "HH:mm" or "HH:mm:ss" format, depending on withSeconds.
defaultValuestring | null-Initial value in uncontrolled mode, with the same shape as value.
withSecondsbooleanfalseWhether to show the seconds segment and include seconds in the value.
size"sm" | "md" | "lg""md"Field size, on the same scale as Input (32 / 40 / 48px), so controls on one form row line up.
minTimestring-Earliest allowed time, inclusive, with the same shape as value.
maxTimestring-Latest allowed time, inclusive.
clearablebooleantrueWhether to show a clear button when the field has a value and is neither disabled nor read-only.
disabledbooleanfalseDisables the field and prevents its segments from receiving focus.
readOnlybooleanfalsePrevents value changes while preserving segment navigation.
aria-labelstringFrom ConfigProvider localeAccessible group name. An explicit value overrides the locale default; segment labels also follow the locale.
classNamestring-Additional class name for the outer container.

Events

EventTypeDescription
onValueChange(value: string | null) => voidTriggered only after every required segment is complete; clearing the value returns null.

Localization

The group, hour/minute/second segments, empty-value announcement, and clear
action follow the nearest ConfigProvider locale. An explicit aria-label
takes precedence. A legacy custom locale without components.timeField
retains the original Chinese compatibility labels.

Keyboard

KeyAction
↑ / ↓Increment or decrement the active segment, wrapping within its range (23 → 0). In an empty segment, ↑ starts at the minimum and ↓ at the maximum.
← / →Move between segments without wrapping past either end.
0-9Replaces the current segment through a two-digit buffer and advances after two digits. If the first digit cannot begin a valid two-digit value (for example 3 for hours), it commits that one digit immediately.
Backspace / DeleteClear the active segment.

Example

tsx
// Basic
<TimeField defaultValue="09:30" />

// Controlled
const [time, setTime] = useState<string | null>(null);
<TimeField value={time} onValueChange={setTime} />

// With seconds
<TimeField withSeconds defaultValue="09:30:15" />

// Range limits are applied only after every segment is complete
<TimeField defaultValue="12:00" minTime="09:30" maxTime="18:00" />

Usage guidelines

  • Partial times do not emit. onValueChange fires only after every required segment is complete; intermediate editing state remains internal by design.
  • minTime and maxTime clamp only after the complete value is entered. Segment-level clamping would block valid entry sequences before later segments exist. The tradeoff is that a completed 23:00 may visibly clamp to 18:00.
  • An invalid second digit restarts the segment with that digit instead of clamping. Typing 2, then 9 for hours produces 09; inventing 23 would not reflect what the user entered.
  • Boundary values are normalized to the active shape. With withSeconds, maxTime="18:00" means 18:00:00, not every time through 18:00:59.
  • Segments use <span role="spinbutton">, not three inputs, to preserve custom two-digit buffering without browser IME, autofill, and validation interference. The component therefore does not participate in native form submission; collect its value through controlled state.
  • readOnly still permits ←/→ segment navigation for inspection, while arrows that change values and numeric keys are disabled.

Related

TimePicker · DateTimePicker · DatePicker · Calendar · DateRangePicker · InputOtp

Playground

--:--
<TimeField
  value={time}
  onValueChange={setTime}
/>
PreviousTimePickerFormsNextForm

On this page

  • Usage
  • Documentation
    • When to use
    • Import
    • Props
    • Events
    • Localization
    • Keyboard
    • Example
    • Usage guidelines
    • Related
  • Playground