import React from 'react'; import { Field, FieldProps } from 'formik'; import classNames from 'classnames'; interface Props { id?: string; type: string; name: string; label?: string; description?: string; autoFocus?: boolean; validate?: (value: any) => undefined | string | Promise; } export default ({ id, type, name, label, description, autoFocus, validate }: Props) => ( { ({ field, form: { errors, touched } }: FieldProps) => ( {label && } {touched[field.name] && errors[field.name] ?

{(errors[field.name] as string).charAt(0).toUpperCase() + (errors[field.name] as string).slice(1)}

: description ?

{description}

: null }
) }
);