diff --git a/app/javascript/gabsocial/components/input.js b/app/javascript/gabsocial/components/input.js index b11921b5..7c4a85b5 100644 --- a/app/javascript/gabsocial/components/input.js +++ b/app/javascript/gabsocial/components/input.js @@ -29,6 +29,7 @@ class Input extends React.PureComponent { id, hideLabel, maxLength, + isRequired, } = this.props const inputClasses = CX({ @@ -93,6 +94,7 @@ class Input extends React.PureComponent { onBlur={onBlur} readOnly={readOnly} maxLength={maxLength} + required={isRequired ? true : undefined} /> { @@ -128,6 +130,7 @@ Input.propTypes = { readOnly: PropTypes.string, inputRef: PropTypes.func, id: PropTypes.string.isRequired, + isRequired: PropTypes.bool, hideLabel: PropTypes.bool, maxLength: PropTypes.number, } diff --git a/app/javascript/gabsocial/components/textarea.js b/app/javascript/gabsocial/components/textarea.js index d6788031..d1c0c510 100644 --- a/app/javascript/gabsocial/components/textarea.js +++ b/app/javascript/gabsocial/components/textarea.js @@ -18,6 +18,7 @@ class Textarea extends React.PureComponent { onFocus, onBlur, title, + isRequired, } = this.props const inputClasses = CX({ @@ -57,6 +58,7 @@ class Textarea extends React.PureComponent { onKeyUp={onKeyUp} onFocus={onFocus} onBlur={onBlur} + required={isRequired ? true : undefined} /> @@ -74,6 +76,7 @@ Textarea.propTypes = { onFocus: PropTypes.func, onBlur: PropTypes.func, title: PropTypes.string, + isRequired: PropTypes.bool, } export default Textarea \ No newline at end of file