Dates
DateField & TimeField
Keyboard-first date and time inputs without a calendar. The segment order, separators, digits, 12/24-hour clock and even the calendar system come from the locale.
import '@reactloom/dates/styles.css';
import { DateField, TimeField } from '@reactloom/dates';Examples
Dates and times
granularity adds time segments to a date.
import { DateField, TimeField, parseDate, parseTime } from '@reactloom/dates';
import { Stack } from '@reactloom/ui';
export default function Example() {
return (
<Stack gap="4" style={{ width: '100%', maxWidth: 280 }}>
<DateField label="Birthday" defaultValue={parseDate('1990-05-17')} />
<DateField label="Starts" granularity="minute" placeholderValue={parseDate('2026-11-10')} />
<TimeField label="Daily stand-up" defaultValue={parseTime('09:30')} />
</Stack>
);
}Locales
The same value in five locales, including an Islamic calendar in Arabic.
import { DateField, parseDate } from '@reactloom/dates';
import { LocaleProvider, Stack } from '@reactloom/ui';
const value = parseDate('2026-11-10');
export default function Example() {
// Segment order, separators, digits and calendar system come from the locale.
return (
<Stack gap="4" style={{ width: '100%', maxWidth: 280 }}>
{['en-US', 'en-GB', 'de-DE', 'ja-JP', 'ar-EG-u-ca-islamic'].map((locale) => (
<LocaleProvider key={locale} locale={locale}>
<div dir={locale.startsWith('ar') ? 'rtl' : 'ltr'}>
<DateField label={locale} defaultValue={value} />
</div>
</LocaleProvider>
))}
</Stack>
);
}API reference
DateField props
| Prop | Type | Default |
|---|---|---|
labelVisible label, associated with the control. | ReactNode | — |
descriptionHelp text linked with aria-describedby. | ReactNode | — |
errorError message; marks the control invalid and is described. | ReactNode | — |
invalidInvalid without a message. | boolean | false |
hideLabelKeep the label for screen readers, hide it visually. | boolean | false |
value / defaultValue | DateValue | null | — |
granularity | 'day' | 'hour' | 'minute' | 'second' | 'day' |
placeholderValueStarting point for empty segments. | DateValue | — |
hideTimeZone | boolean | false |
TimeField props
| Prop | Type | Default |
|---|---|---|
value / defaultValueFrom parseTime(). | Time | null | — |
granularity | 'hour' | 'minute' | 'second' | 'minute' |
hourCycle | 12 | 24 | — |
Customization
Extracted from the component’s source on every build, so it matches the code. How the layers fit together is explained in Customization.
DateField
CSS variables
| Variable | Default |
|---|---|
--pl-input-radius | var(--pl-radius-md |
Theme tokens it reads
--pl-color-border-default --pl-color-border-focus --pl-color-fg-default --pl-color-fg-disabled --pl-focus-ring-color --pl-focus-ring-width --pl-radius-md --pl-shadow-xs
TimeField
CSS variables
| Variable | Default |
|---|---|
--pl-input-radius | var(--pl-radius-md |
Theme tokens it reads
--pl-color-border-default --pl-color-border-focus --pl-color-fg-default --pl-color-fg-disabled --pl-focus-ring-color --pl-focus-ring-width --pl-radius-md --pl-shadow-xs
Accessibility
- A group named by the label contains one spin button per unit.
- Typing digits auto-advances; Backspace clears a segment.
| Key | Action |
|---|---|
| ← / → | Move between segments |
| ↑ / ↓ | Increment / decrement |
| 0–9 | Type a value |
| Backspace | Clear the segment |
Usage guidelines
Do
- Use for dates people know (birthdays, document dates).
Don’t
- Don’t split dates into three separate inputs.