0.7.3 • Published 3 years ago

@slice-and-dice/govuk-react-date-field v0.7.3

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

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

PropRequiredDefaultTypeDescription
childrentrue | node
defaultValues{ day: undefined, month: undefined, year: undefined, }custom
errorTextundefinedstringError text
hintTextundefinedstringOptional hint text
inputundefinedshapeobject ObjectProperties that are sent to the input, matching final form and redux form input type
inputNames{ day: undefined, month: undefined, year: undefined, }shapeobject ObjectInput name attributes