DateInput
Import
import DateInput from '@govuk-react/date-input';
Usage
Simple
<DateInput>What is your date of birth?</DateInput>
Date with hint text
<DateInput hintText="For example, 31 03 1980">
What is your date of birth?
</DateInput>
Date with hint text & error
<DateInput
hintText="For example, 31 03 1980"
errorText="Error message goes here"
>
What is your date of birth?
</DateInput>
With custom input name props
<DateInput inputNames={{ day: 'dayInputName' }} hintText="For example, 31 03 1980">
What is your date of birth?
</DateInput>
References:
Properties
Prop | Required | Default | Type | Description |
---|---|---|---|---|
children |
true | `````` | node | |
errorText |
undefined |
string | Error text | |
hintText |
undefined |
string | Optional hint text | |
inputNames |
{ day: 'dateInputDay', month: 'dateInputMonth', year: 'dateInputYear', } |
shape[object Object] | Input name attributes |