DateField
Import
import DateField from '@govuk-react/date-field';
Usage
Simple
<DateField>What is your date of birth?</DateField>
Date with hint text
<DateField hintText="For example, 31 03 1980">
What is your date of birth?
</DateField>
Date with hint text & error
<DateField
hintText="For example, 31 03 1980"
errorText="Error message goes here"
>
What is your date of birth?
</DateField>
With custom input name props
<DateField hintText="For example, 31 03 1980"
inputNames={{
day: 'dayInputName',
month: 'monthInputName',
year: 'yearInputName',
}}
>
What is your date of birth?
</DateField>
References:
Properties
Prop | Required | Default | Type | Description |
---|---|---|---|---|
children |
true | `````` | node | |
defaultValues |
{ day: undefined, month: undefined, year: undefined, } |
custom | ||
errorText |
undefined |
string | Error text | |
hintText |
undefined |
string | Optional hint text | |
input |
undefined |
shape[object Object] | Properties that are sent to the input, matching final form and redux form input type | |
inputNames |
{ day: undefined, month: undefined, year: undefined, } |
shape[object Object] | Input name attributes |