File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
src/MatBlazor/Components/MatTextField Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -146,11 +146,17 @@ protected BaseMatInputTextComponent()
146
146
( ) => this . FullWidth && this . Icon != null && this . IconTrailing )
147
147
. If ( "mdc-text-field--textarea" , ( ) => this . TextArea ) ;
148
148
149
+ bool TextOrPlaceHolderVisible ( )
150
+ {
151
+ return ! string . IsNullOrEmpty ( CurrentValueAsString )
152
+ || ( ! string . IsNullOrWhiteSpace ( PlaceHolder ) && FullWidth ) ;
153
+ }
154
+
149
155
LabelClassMapper
150
156
. Add ( "mdc-floating-label" )
151
157
. If ( "mat-floating-label--float-above-outlined" ,
152
- ( ) => Outlined && ! string . IsNullOrEmpty ( CurrentValueAsString ) )
153
- . If ( "mdc-floating-label--float-above" , ( ) => ! string . IsNullOrEmpty ( CurrentValueAsString ) ) ;
158
+ ( ) => Outlined && TextOrPlaceHolderVisible ( ) )
159
+ . If ( "mdc-floating-label--float-above" , ( ) => TextOrPlaceHolderVisible ( ) ) ;
154
160
155
161
InputClassMapper
156
162
. Get ( ( ) => this . InputClass )
@@ -162,4 +168,4 @@ protected BaseMatInputTextComponent()
162
168
CallAfterRender ( async ( ) => { await JsInvokeAsync < object > ( "matBlazor.matTextField.init" , Ref ) ; } ) ;
163
169
}
164
170
}
165
- }
171
+ }
You can’t perform that action at this time.
0 commit comments