aboutsummaryrefslogtreecommitdiff
path: root/components/TextArea/index.tsx
blob: c40efed065a7fe4acca321f2da8e4199b4f86d36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import React, { TextareaHTMLAttributes, ForwardRefRenderFunction } from 'react';
import { getSystemStyle, SystemProps } from '../utils/systemProps';
import inputElStyle from '../utils/inputElementStyle';

interface TextAreaProps
  extends TextareaHTMLAttributes<HTMLTextAreaElement>,
  SystemProps
{ }

const TextArea: ForwardRefRenderFunction<HTMLTextAreaElement, TextAreaProps> = 
  ({ style, ...props }, ref) => {
    style = {
      ...inputElStyle,
      ...style,
    };

    const systemStyle = getSystemStyle(props, style);

    return <textarea ref={ref} style={systemStyle} {...props} />;
  };

export default React.forwardRef(TextArea);