@navinc/base-react-components
Version:
Nav's Pattern Library
23 lines (20 loc) • 695 B
Markdown
All form-element components expect to be controlled components. This makes them
immediately compatible with form managers like formik or redux-form, as well as
within any stateful component.
In addition to native form element attributes, all form-element components
implement these props
```
<DatePicker
errors={touched.businessStartDate && errors.businessStartDate}
fieldsToShow={['year', 'month']}
isInvalid={touched.businessStartDate && errors.businessStartDate}
label='Business start date'
onBlur={() => setFieldTouched('businessStartDate')}
onChange={(e) => setFieldValue('businessStartDate', e.target.value)}
value={{
day: 25,
month: 12,
year: 1950
}}
/>
```