@@ -68,13 +68,9 @@ export const FormElement = createFC<
6868 : undefined
6969 : undefined ;
7070
71- const formElementControlClassNames = classnames (
72- 'slds-form-element__control' ,
73- { 'slds-has-divider_bottom' : readOnly }
74- ) ;
75-
7671 const formElementClassNames = classnames (
7772 'slds-form-element' ,
73+ readOnly ? 'slds-form-element_readonly' : null ,
7874 error ? 'slds-has-error' : null ,
7975 typeof totalCols === 'number'
8076 ? `slds-size_${ cols } -of-${ totalCols } `
@@ -93,11 +89,13 @@ export const FormElement = createFC<
9389
9490 const emptyCtx = useMemo ( ( ) => ( { } ) , [ ] ) ;
9591
92+ const LabelTag = readOnly ? 'span' : 'label' ;
93+
9694 return (
9795 < FieldSetColumnContext . Provider value = { emptyCtx } >
9896 < div ref = { elementRef } className = { formElementClassNames } >
9997 { label ? (
100- < label
98+ < LabelTag
10199 className = 'slds-form-element__label'
102100 htmlFor = { id }
103101 onClick = { id ? undefined : onClickLabel }
@@ -112,13 +110,17 @@ export const FormElement = createFC<
112110 </ abbr >
113111 ) : undefined }
114112 { label }
115- </ label >
113+ </ LabelTag >
116114 ) : null }
117115 { tooltip ? (
118116 < TooltipContent icon = { tooltipIcon } > { tooltip } </ TooltipContent >
119117 ) : null }
120- < div ref = { controlElRef } className = { formElementControlClassNames } >
121- { children }
118+ < div ref = { controlElRef } className = 'slds-form-element__control' >
119+ { readOnly ? (
120+ < div className = 'slds-form-element__static' > { children } </ div >
121+ ) : (
122+ children
123+ ) }
122124 { dropdown }
123125 { errorMessage ? (
124126 < span
0 commit comments