@govuk-react/date-input
v0.2.12
Published
Date input component displaying day, month and year and featuring several configurable options.
Downloads
26
Keywords
Readme
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:
- https://github.com/alphagov/govuk-frontend/tree/master/src/components/date-input
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