File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ const Input = props => {
43
43
maxlength,
44
44
minLength,
45
45
minlength,
46
+ readonly,
46
47
tabIndex,
47
48
tabindex,
48
49
...otherProps
@@ -163,6 +164,7 @@ const Input = props => {
163
164
inputMode = { inputmode || inputMode }
164
165
maxLength = { maxlength || maxLength }
165
166
minLength = { minlength || minLength }
167
+ readOnly = { readonly }
166
168
tabIndex = { tabindex || tabIndex }
167
169
size = { html_size }
168
170
/>
@@ -525,11 +527,20 @@ Input.propTypes = {
525
527
] ) ,
526
528
527
529
/**
528
- * Set to true for a readonly input styled as plain text with the default
529
- * form field styling removed and the correct margins and padding preserved.
530
+ * Set to true for an input styled as plain text with the default form field
531
+ * styling removed and the correct margins and padding preserved. Typically
532
+ * you will want to use this in conjunction with readonly=True.
530
533
*/
531
534
plaintext : PropTypes . bool ,
532
535
536
+ /**
537
+ * Indicates whether the element can be edited.
538
+ */
539
+ readonly : PropTypes . oneOfType ( [
540
+ PropTypes . bool ,
541
+ PropTypes . oneOf ( [ 'readOnly' , 'readonly' , 'READONLY' ] )
542
+ ] ) ,
543
+
533
544
/**
534
545
* A hint to the user of what can be entered in the control . The placeholder
535
546
* text must not contain carriage returns or line-feeds. Note: Do not use the
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ describe('Input', () => {
49
49
pattern = "test-pattern"
50
50
placeholder = "test-placeholder"
51
51
html_size = "42"
52
+ readonly
52
53
step = { 2 }
53
54
tabindex = "3"
54
55
type = "text"
@@ -66,6 +67,7 @@ describe('Input', () => {
66
67
expect ( input ) . toHaveAttribute ( 'name' , 'test-name' ) ;
67
68
expect ( input ) . toHaveAttribute ( 'pattern' , 'test-pattern' ) ;
68
69
expect ( input ) . toHaveAttribute ( 'placeholder' , 'test-placeholder' ) ;
70
+ expect ( input ) . toHaveAttribute ( 'readonly' ) ;
69
71
expect ( input ) . toHaveAttribute ( 'size' , '42' ) ;
70
72
expect ( input ) . toHaveAttribute ( 'step' , '2' ) ;
71
73
expect ( input ) . toHaveAttribute ( 'tabindex' , '3' ) ;
You can’t perform that action at this time.
0 commit comments