Skip to content

Commit cfbcb6b

Browse files
authored
Merge pull request #552 from facultyai/input-required
Add required prop to Input
2 parents 7a878dc + f3e04ad commit cfbcb6b

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

src/components/input/Input.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,20 @@ Input.propTypes = {
343343
*/
344344
invalid: PropTypes.bool,
345345

346+
/**
347+
* This attribute specifies that the user must fill in a value before
348+
* submitting a form. It cannot be used when the type attribute is hidden,
349+
* image, or a button type (submit, reset, or button). The :optional and
350+
* :required CSS pseudo-classes will be applied to the field as appropriate.
351+
* required is an HTML boolean attribute - it is enabled by a boolean or
352+
* 'required'. Alternative capitalizations `REQUIRED`
353+
* are also acccepted.
354+
*/
355+
required: PropTypes.oneOfType([
356+
PropTypes.oneOf(['required', 'REQUIRED']),
357+
PropTypes.bool
358+
]),
359+
346360
/**
347361
* Set to true for a readonly input styled as plain text with the default
348362
* form field styling removed and the correct margins and padding preserved.

src/components/input/Select.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,20 @@ Select.propTypes = {
139139
*/
140140
disabled: PropTypes.bool,
141141

142+
/**
143+
* This attribute specifies that the user must fill in a value before
144+
* submitting a form. It cannot be used when the type attribute is hidden,
145+
* image, or a button type (submit, reset, or button). The :optional and
146+
* :required CSS pseudo-classes will be applied to the field as appropriate.
147+
* required is an HTML boolean attribute - it is enabled by a boolean or
148+
* 'required'. Alternative capitalizations `REQUIRED`
149+
* are also acccepted.
150+
*/
151+
required: PropTypes.oneOfType([
152+
PropTypes.oneOf(['required', 'REQUIRED']),
153+
PropTypes.bool
154+
]),
155+
142156
/**
143157
* Apply valid style to the Input for feedback purposes. This will cause
144158
* any FormFeedback in the enclosing FormGroup with valid=True to display.

src/components/input/Textarea.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,13 @@ Textarea.propTypes = {
175175
]),
176176

177177
/**
178-
* Indicates whether this element is required to fill out or not.
178+
* This attribute specifies that the user must fill in a value before
179+
* submitting a form. It cannot be used when the type attribute is hidden,
180+
* image, or a button type (submit, reset, or button). The :optional and
181+
* :required CSS pseudo-classes will be applied to the field as appropriate.
182+
* required is an HTML boolean attribute - it is enabled by a boolean or
183+
* 'required'. Alternative capitalizations `REQUIRED`
184+
* are also acccepted.
179185
*/
180186
required: PropTypes.oneOfType([
181187
PropTypes.oneOf(['required', 'REQUIRED']),

0 commit comments

Comments
 (0)