// preview in
saved for every page

Date field

Types a date into day, month and year segments in the order and format of the locale. For dates people already know, like a birthday or a contract start, with no calendar in the way.

Built on React AriaPattern WAI-ARIA Spinbutton (one per segment)Client componentSource ↗
minimal · light · #3fa34d
11122026
granularity
readOnly
invalid
disabled

Installation

Set up Camaleo once (Installation), then import what you need. Values are @internationalized/date objects, re-exported from the package; put the field in a Field to give it a label.

import { DateField, CalendarDate, CalendarDateTime, Field, FieldLabel } from "@camaleo/react";

Anatomy

A box with one segment per part of the date. Literals like / are segments too, drawn for the eye and skipped by the keyboard.

input11162026
[data-slot="date-field"][data-slot="date-input"][data-slot="date-segment"]

Examples

Every example is a real file you can copy. They all wear the skin, mode and brand from the bar above.

minimal · light · #3fa34d
11162026

The first day the new rate applies.

12182026

Sent to the API: 2026-12-18

Controlled

Type a new date. onChange gives you a CalendarDate, and toString() is the ISO date your API expects, with no time zone to go wrong.

10152010
You must be 18 or older. Check the year you were born.

Birth date with limits

Change the year to 2008 or earlier. minValue and maxValue mark the field invalid, and a FieldError says which rule failed.

111220261030AM

Clinics open from 8:00 AM to 6:00 PM.

Date and time

Pass a CalendarDateTime and granularity="minute" when the time belongs to the date, like an appointment. Hours follow the locale's clock.

mmddyyyy

Press Arrow Up: it starts from 2020, not from today.

Placeholder value

An empty field starts from today when people press the arrows. placeholderValue starts it closer to the answer, without filling anything in.

11122026
12112026
12112026

Locales

The same 12 November 2026 in three locales: is it 11/12 or 12/11? locale sets the segment order and separators, so match it to the page's language.

10162023

Set by HR. Ask them to correct it.

Read-only

readOnly keeps the value focusable and readable by screen readers. Say in the description who can change it.

10302026

Opens again once the 2026 return is reviewed.

Disabled

disabled on the Field reaches the label and every segment. Tell people when it opens again.

In context

Date fields come in forms. These are whole pieces of UI you can copy, in the skin you picked.

Create your account

We use your date of birth to confirm your age.

mmddyyyy

You must be 18 or older to open an account.

Signup with date of birthCard · Field · Input · DateField · Button

Passport

Needed for international flights.

10172022
10162032

Valid for at least 6 months after your return.

Travel documentCard · Field · Input · DateField · Button

Invoice INV-2048

Bright Studio · $4,850.00

11102026
12102026
Invoice due dateCard · DateField · NativeSelect · Button

Guidelines

11211994

Type the numbers or use the arrow keys.

DoOne field for a known date.

People type a birthday from memory; the segments take the digits in order.

Date of birth
Don’tThree selects for day, month and year.

Three lists to open and scroll, and nothing stops 31 February.

10152010
You must be 18 or older. Check the year you were born.
DoSay which rule failed.

The message tells people what to change, and a screen reader reads it with the field.

10152010
Don’tA red border and nothing else.

People see something is wrong, not what. Color alone is not an error message.

Props

PropTypeDefaultDescription
classNamestring—Classes added to the root.
styleCSSProperties—Inline styles for the root.
disabledboolean—Disables every segment. Inside a Field, the field's disabled is used when this is not set.
readOnlybooleanfalseKeeps the value focusable and readable, but not editable.
invalidboolean—Marks the field invalid. Inside a Field, the field's invalid is used when this is not set.
requiredbooleanfalseMarks the field required for assistive tech.
localestring—BCP 47 locale for the segment order, separators and clock, such as "en-US" or "pt-BR". Defaults to the nearest I18nProvider or the browser's language.
valueDateValue | null—The current value (controlled).
defaultValueDateValue | null—The default value (uncontrolled).
onChange(value: DateValue | null) => void—Handler that is called when the value changes.
namestring—The name of the input element, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname).
autoFocusboolean—Whether the element should receive focus on render.
minValueDateValue—The minimum allowed date that a user may select.
maxValueDateValue—The maximum allowed date that a user may select.
isDateUnavailable(date: DateValue) => boolean—Callback that is called for each date of the calendar. If it returns true, then the date is unavailable.
placeholderValueDateValue—A placeholder date that influences the format of the placeholder shown when no value is selected. Defaults to today's date at midnight.
hourCycle12 | 24—Whether to display the time in 12 or 24 hour format. By default, this is determined by the user's locale.
granularity"day" | "hour" | "minute" | "second"—Determines the smallest unit that is displayed in the date picker. By default, this is "day" for dates, and "minute" for times.
hideTimeZonebooleanfalseWhether to hide the time zone abbreviation.
shouldForceLeadingZerosboolean—Whether to always show leading zeros in the month, day, and hour fields. By default, this is determined by the user's locale.

validationBehavior defaults to "aria": an out-of-range value marks the field invalid but never blocks the form. React Aria's other props pass through, such as onFocusChange, onKeyDown and form.

Styling hooks

Restyle it without forking: target the attributes, or set the tokens on a parent, a skin or the field itself.

Attributes

data-slot"date-field" · "date-input" · "date-segment"
data-invalidon the root and segments when invalid
data-disabled · data-readonlyon the root and segments when disabled · read-only
data-placeholderon a segment with no value yet
data-typea segment's part: day · month · year · hour · minute · literal…
data-focusedon the segment that has focus

Tokens it reads

Color

--cml-accent--cml-accent-fg--cml-border-control--cml-danger--cml-fg--cml-fg-muted--cml-field-bg--cml-field-border-sides--cml-field-shadow--cml-focus-ring

Shape & size

--cml-field-border-width--cml-field-height--cml-field-padding--cml-font-size-field--cml-radius-control--cml-radius-field

Type & motion

--cml-duration-fast--cml-ease-standard--cml-font-field

This component only

--cml-corner-shape--cml-disabled-opacity--cml-segment-focus-bg--cml-segment-focus-border--cml-segment-focus-fg--cml-segment-focus-shadow--cml-segment-radius
/* square, outlined segments, only in this form */
.passport-form [data-slot="date-field"] {
  --cml-segment-radius: 0;
  --cml-segment-focus-bg: transparent;
  --cml-segment-focus-fg: var(--cml-accent-text);
  --cml-segment-focus-shadow: inset 0 -2px 0 var(--cml-accent);
}

Accessibility

0–9Types into the focused segment and moves to the next one when it is full.
Arrow Up · Arrow DownAdds or subtracts one, wrapping at the end of the segment.
Arrow Left · Arrow RightMoves between segments.
Page Up · Page DownSteps by a bigger amount, like 5 years.
BackspaceClears the focused segment.
TabMoves to the next segment, then out of the field.
Was this page helpful? · Edit this page on GitHub