Textarea.tsx 495 B

1234567891011121314151617
  1. import { FunctionComponent, TextareaHTMLAttributes } from "react"
  2. import styles from './forms.module.css';
  3. interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
  4. label?: string
  5. }
  6. export const Textarea: FunctionComponent<TextareaProps> = ({ label, id, ...props }) => (
  7. <div className={styles.input}>
  8. {label && <label htmlFor={id}>{label}</label>}
  9. <textarea className={styles.textInput} id={id} {...props} />
  10. </div>
  11. );
  12. Textarea.defaultProps = {
  13. rows: 5,
  14. }