Skip to content

Date field

The date field let the user select a date with the keyboard.

Basic usage

Press Enter to start editing

Uncontrolled vs. Controlled

The component can be controlled or uncontrolled

Press Enter to start editing

Customize the input props

Customize the date format

Localization

Press Enter to start editing

Date validation

The DateField component supports all the date validation props described in the validation page

TODO: Add link to the future standalone validation doc page

TODO: Add time validation examples when supported

When is onChange called

The DateField component has an internal state to update the visible date. It will only call the onChange callback when the modified date is valid.

In the demo below, you can see that the component reacts to an external date update (when pressing "Set to today"). And that when debouncing the state (for instance if you have a server side persistence) do not affect the rendering of the field.

Value outside the field: 04/07/2022

Press Enter to start editing

Headless usage