File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import React, {
77 useRef ,
88} from 'react' ;
99import classnames from 'classnames' ;
10+ import { Text } from './Text' ;
1011import { FormElement , FormElementProps } from './FormElement' ;
1112import { FieldSetColumnContext } from './FieldSet' ;
1213import { useEventCallback } from './hooks' ;
@@ -45,6 +46,7 @@ export const Textarea = createFC<TextareaProps, { isFormElement: boolean }>(
4546 textareaRef,
4647 onChange : onChange_ ,
4748 onValueChange,
49+ readOnly,
4850 ...rprops
4951 } = props ;
5052 const prevValueRef = useRef < string > ( ) ;
@@ -55,7 +57,11 @@ export const Textarea = createFC<TextareaProps, { isFormElement: boolean }>(
5557 } ) ;
5658 const { isFieldSetColumn } = useContext ( FieldSetColumnContext ) ;
5759 const taClassNames = classnames ( className , 'slds-input' ) ;
58- const textareaElem = (
60+ const textareaElem = readOnly ? (
61+ < Text type = 'regular' category = 'body' >
62+ { rprops . value }
63+ </ Text >
64+ ) : (
5965 < textarea
6066 id = { id }
6167 ref = { textareaRef }
@@ -74,6 +80,7 @@ export const Textarea = createFC<TextareaProps, { isFormElement: boolean }>(
7480 tooltip,
7581 tooltipIcon,
7682 elementRef,
83+ readOnly,
7784 } ;
7885 return < FormElement { ...formElemProps } > { textareaElem } </ FormElement > ;
7986 }
You can’t perform that action at this time.
0 commit comments