Date Input

Segmented date and time input built on react-aria-components.

Overview

DateInput provides segmented, keyboard-friendly inputs for date and time built on top of react-aria-components. It renders discrete segments (day/month/year and hours/minutes) for both date and time inputs. Cubitt defaults the locale to en-AU so dates display using Australian formats out of the box. Pass a locale prop or wrap the component in I18nProvider if you need a different locale.

Always provide an accessible label. Either wrap the input in a visible Label component or pass aria-label/aria-labelledby to DateInputRoot/TimeInputRoot. Component will throw console warning if no label is provided.

Usage

import { DateInputRoot, DateInput, TimeInputRoot } from "@tilt-legal/cubitt-components/primitives";
<DateInputRoot>
  <DateInput />
</DateInputRoot>

<TimeInputRoot>
  <DateInput />
</TimeInputRoot>

<DateInputRoot granularity="minute" hourCycle={24}>
  <DateInput />
</DateInputRoot>

Examples

Time Input

Date & Time Input

API Reference

DateInput

PropTypeDefaultDescription
size"sm" | "md" | "lg""md"Size of the input styling
classNamestringAdditional classes

DateInputRoot

PropTypeDefaultDescription
granularity"day" | "minute" | "second""day"Precision of the field
hourCycle12 | 24localeHour cycle for time-related segments
localestring'en-AU'Locale applied to the segmented field
classNamestringAdditional classes
childrenReact.ReactNodeTypically a DateInput
...RAC propsreact-aria-components DateField APIAll DateField props are supported

TimeInputRoot

PropTypeDefaultDescription
granularity"minute" | "second"Precision of the field
hourCycle12 | 24localeHour cycle
localestring'en-AU'Locale applied to the segmented field
classNamestringAdditional classes
childrenReact.ReactNodeTypically a DateInput
...RAC propsreact-aria-components TimeField APIAll TimeField props are supported

DateInput works with InputGroup, InputAddon, and InputWrapper for adding icons and addons. See Input docs.

On this page