UIComponentsReact
A date and a time typed in segments, month, day, year, hour, minute and a day period, each one a spinbutton, with a button that clears them all.
Built on the headless Date Time Field.See its API in Docs
Rendered by React 19.3.1
Installation
npx shadcn@4.23.0 add https://hamur.dev/r/react/date-time-field.jsonIt also adds utils, button. The app needs its setup first: Installation.
Usage
Put a DateTimeFieldInput and a DateTimeFieldClear inside DateTimeField, and a FieldLabel above it. Without children, DateTimeFieldInput renders every segment, styled; pass your own children to place them yourself, drawing each with DateTimeFieldSegment. Values are strings such as 2026-11-07T14:30. hourCycle chooses 12 or 24 hours and granularity how fine the segments go. The keys, the typing, the limits and the form value come from the headless Date Time Field.
import {
DateTimeField,
DateTimeFieldClear,
DateTimeFieldInput,
DateTimeFieldSegment,
} from '@/components/ui/date-time-field'Examples
Default
A meeting under its label, filled in, in 12 hours, with a Clear button.
It looks as Date Field does: Input's box, the focused segment filled, an empty one dimmed to its placeholder and an invalid one underlined with a dashed line. The box grows with its segments and stops at the width of its container. This item takes Base UI's component ID as its slug and one name per Base UI part.
API reference
The styled parts pass every prop to the headless part they wrap and add classes. The props, data attributes and keyboard are on Date Time Field's API reference.