Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Mirko Jelic
Added: Feb 9, 2019 10:44 AM
Modified: Feb 9, 2019 11:00 AM
Views: 28
Tags: react
  1. import React from 'react'
  2. import classNames from 'classnames'
  3.  
  4. const TextAreaFieldGroup = (
  5.   {
  6.     name,
  7.     placeholder,
  8.     value,
  9.     label,
  10.     error,
  11.     info,
  12.     cols,
  13.     rows,
  14.     onChange,
  15.     disabled
  16.   }
  17.  
  18. ) => {
  19.  
  20.   return (
  21.     <div className='form-control'>
  22.       {error && <div className="form-control__invalid--feedback">{error}</div>}
  23.       <textarea
  24.         className={classNames('form-control__placeholder',{'form-control__placeholder-invalid':error})}
  25.         placeholder={placeholder}
  26.         name={name}
  27.         value={value}
  28.         onChange={onChange}
  29.         cols={cols}
  30.         rows={rows}
  31.         disabled={disabled}
  32.       />
  33.       {info && <small className="form__info">{info}</small>}
  34.     </div>
  35.   )
  36. }
  37.  
  38. export default TextAreaFieldGroup
  39.