@govuk-react/date-input

Date input component displaying day, month and year and featuring several configurable options.

Stats

StarsIssuesVersionUpdatedCreatedSize
@govuk-react/date-input
0.2.123 years ago4 years agoMinified + gzip package size for @govuk-react/date-input in KB

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:

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

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.