Description
Field.Date
is a wrapper component for the input of strings, with user experience tailored for date values.
import { Field } from '@dnb/eufemia/extensions/forms'render(<Field.Date />)
There is a corresponding Value.Date component.
Demos
Empty
Code Editor
<Field.Date onChange={(value) => console.log('onChange', value)} />
Placeholder
Code Editor
<Field.Dateplaceholder="Enter a date"onChange={(value) => console.log('onChange', value)}/>
Label
Code Editor
<Field.Datelabel="Label text"onChange={(value) => console.log('onChange', value)}/>
Label and value
Code Editor
<Field.Datevalue="2023-01-16"label="Label text"onChange={(value) => console.log('onChange', value)}/>
With help
Code Editor
<Field.Datevalue="2023-01-16"label="Label text"help={{title: 'Help is available',contents:'Kindness and helping others will return to you when you least expect it, and maybe when you need it.',}}onChange={(value) => console.log('onChange', value)}/>
Disabled
Code Editor
<Field.Datevalue="2023-01-16"label="Label text"onChange={(value) => console.log('onChange', value)}disabled/>
Error
Code Editor
<Field.Datevalue="2023-01-16"label="Label text"onChange={(value) => console.log('onChange', value)}error={new FormError('This is what is wrong...')}/>
Validation - Required
Code Editor
<Field.Datevalue="2023-01-16"label="Label text"onChange={(value) => console.log('onChange', value)}required/>