Skip to content

Data Input

DateTimeInput

Segmented date and time field with calendar popover.

import { DateTimeInput } from '@var-ui/react';
Appointment

DateTimeInput

Combined date and time field: month/day/year plus hour/minute (and optional seconds / day-period) segments, with a popover calendar for the date portion. Defaults to granularity="minute". Values typically use CalendarDateTime from @internationalized/date.

Examples

Default

Pass a label and a CalendarDateTime defaultValue (or control via value / onValueChange).

Appointment
Demo.tsxTSX
import { CalendarDateTime } from '@internationalized/date';
import { DateTimeInput } from '@var-ui/react';

<DateTimeInput label="Appointment" defaultValue={new CalendarDateTime(2026, 8, 12, 14, 30)} />

Granularity

Set granularity to control the smallest editable time unit. "second" adds a seconds segment; "day" hides time segments entirely.

Appointment

Includes a seconds segment

Demo.tsxTSX
import { CalendarDateTime } from '@internationalized/date';
import { DateTimeInput } from '@var-ui/react';

<DateTimeInput
  label="Appointment"
  defaultValue={new CalendarDateTime(2026, 8, 12, 14, 30, 0)}
  granularity="second"
  description="Includes a seconds segment"
/>

Sizes

size (sm, md, lg) sets the segment group height, inset and type, matching TextField. It falls back to the surrounding control size (InputGroup, Toolbar, Select.Root), then md.

Props

Accessibility

Built on React Aria DatePicker with time granularity. Date and time segments are individually focusable spinbuttons; the calendar trigger opens a dialog for picking the day (time stays in the text field). Keep label visible, and use description / errorMessage for helper and validation copy.