You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
621 B
JavaScript

import React from 'react'
import styles from './styles.module.css'
export default function TextArea({label: _label, error, hint, height, name, value, onChange, onBlur, isValid}){
const label = _label || name.replace(name[0], name[0].toUpperCase())
return (
<div className={styles.formElementContainer}>
<label htmlFor={name}>{label}:</label>
<textarea className={(isValid && !error)?'':styles.invalid} height={height} name={name} value={value} onChange={onChange} onBlur={onBlur} />
{(hint || error) && <span className={styles.hint}>{error || (isValid ? '' : hint)}</span>}
</div>
)
}