# All files / layouts/Form TextAreaField.js

33.33% Statements 1/3
100% Branches 0/0
0% Functions 0/1
33.33% Lines 1/3

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97

    5x

     import React from 'react';
    import PropTypes from 'prop-types';
    import TextArea from '../../components/TextArea';
    import FieldWrapper from './FieldWrapper';

    /**
     * DEPRECATED
     *
     * @class TextAreaField
     * @extends {React.Component}
     */
    class TextAreaField extends React.Component {
      static propTypes = {
        /**
         * A collection of input props. Passed to input.
         */
        input: PropTypes.shape({
          value: PropTypes.string,
          onChange: PropTypes.func,
        }),
        /**
         * Indicates whether a user can change this field.
         */
        disabled: PropTypes.bool,
        /**
         * Indicates whether this field is required for form submission.
         */
        required: PropTypes.bool,
        /**
         * Contents of a label above the field.
         */
        label: PropTypes.string,
        /**
         * Adds an id to the textarea.
         */
        id: PropTypes.string,
        /**
         * Adds a class name to the textarea.
         */
        className: PropTypes.string,
        /**
         * Contents of help text below the field.
         */
        helpText: PropTypes.string,
        /**
         * Optional callout contents to show when the user hovers the field.
         */
        callout: PropTypes.node,
      };

      static defaultProps = {
        disabled: false,
        required: false,
        label: null,
        id: null,
        className: null,
        helpText: null,
        callout: null,
      };

      render() {
        const { input, label, id, className, disabled, required, helpText, callout } = this.props;
        return (
          <FieldWrapper
            label={label}
            helpText={helpText}
            disabled={disabled}
            required={required}
            callout={callout}
          >
            <TextArea {...input} id={id} className={className} disabled={disabled} required={required} />
          </FieldWrapper>
        );
      }
    }

    TextAreaField.usage = `
    # TextAreaField

    An input component that renders a large field for entering long text.

    Props:

    * \`input\`: supplied by Redux Form's Field component, you can also specify this manually. Should contain \`value\` and \`onChange\` at least.
    * \`label\`: a renderable label to go above the component
    * \`helpText\`: some text to be rendered below the component
    * \`disabled\`: disables the component
    * \`required\`: adds a required mark and HTML field validation
    * \`callout\`: optional flyout to show on hover

    \`\`\`
    <TextAreaField input={input} label="big text" helpText="write a lot here" required />
    \`\`\`
    `;

    export default TextAreaField;