Skip to content
Nacre
Color palette
中文

TimeField

experimentalTimeFieldOpen in playground
TimeField
Runs the real component in your browser.

Edit hours and minutes in 24-hour time. Used for quiet hours and date filters.

Status: experimental · Components: TimeField

import { TimeField } from 'nacre'
import { signal } from 'nsh'
import { TimeField } from 'nacre'
export function TimeFieldUsage() {
const time = signal('09:30')
return <TimeField testID="demo-time" accessibilityLabel="Start time" value={time()} onChange={time.set} />
}

Keeps the current value and skips keyboard focus.

Phone: Keeps the current time, dimmed and not editable.

import { TimeField } from 'nacre'
export function TimeFieldDisabled() {
return <TimeField testID="demo-time-disabled" accessibilityLabel="End time" value="18:00" onChange={() => {}} disabled />
}
Key Action
← / → Select the hour or minute segment
↑ / ↓ Adjust the selected segment
  • Use accessibilityLabel to distinguish start and end times. The ring surrounds the field and a soft fill and inset stroke mark the active segment.

Do

  • Write the HH:mm value back in onChange

Don’t

  • Use a minute field when only whole hours are available

Property descriptions follow the Chinese source comments.

Prop Type Default Description
value * string — 24 小时制 HH:mm
onChange * (value: string) => void —
accessibilityLabel * string —
disabled boolean —
testID string —

* required