Examples

Dates and times

granularity adds time segments to a date.

Preview
5
17
1990
mm
dd
yyyy
––
––
AM
9
30
AM
Example.tsx
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.

Preview
11
10
2026
10
11
2026
10
11
2026
2026
11
10
١٠
١١
٢٠٢٦
هـ
Example.tsx
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

DateField props
PropTypeDefault
label
Visible label, associated with the control.
ReactNode—
description
Help text linked with aria-describedby.
ReactNode—
error
Error message; marks the control invalid and is described.
ReactNode—
invalid
Invalid without a message.
booleanfalse
hideLabel
Keep the label for screen readers, hide it visually.
booleanfalse
value / defaultValue
DateValue | null—
granularity
'day' | 'hour' | 'minute' | 'second''day'
placeholderValue
Starting point for empty segments.
DateValue—
hideTimeZone
booleanfalse

TimeField props

TimeField props
PropTypeDefault
value / defaultValue
From 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

VariableDefault
--pl-input-radiusvar(--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

VariableDefault
--pl-input-radiusvar(--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.
Keyboard interactions
KeyAction
← / →Move between segments
↑ / ↓Increment / decrement
0–9Type a value
BackspaceClear the segment

Usage guidelines

Do

  • Use for dates people know (birthdays, document dates).

Don’t

  • Don’t split dates into three separate inputs.