Skip to content

Commit 97dc4ad

Browse files
authored
Merge pull request #677 from stefanloerwald/patch-1
Fix part of #659
2 parents 024b0d1 + 00f2dc5 commit 97dc4ad

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/MatBlazor/Components/MatTextField/BaseMatInputTextComponent.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,17 @@ protected BaseMatInputTextComponent()
146146
() => this.FullWidth && this.Icon != null && this.IconTrailing)
147147
.If("mdc-text-field--textarea", () => this.TextArea);
148148

149+
bool TextOrPlaceHolderVisible()
150+
{
151+
return !string.IsNullOrEmpty(CurrentValueAsString)
152+
|| (!string.IsNullOrWhiteSpace(PlaceHolder) && FullWidth);
153+
}
154+
149155
LabelClassMapper
150156
.Add("mdc-floating-label")
151157
.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());
154160

155161
InputClassMapper
156162
.Get(() => this.InputClass)
@@ -162,4 +168,4 @@ protected BaseMatInputTextComponent()
162168
CallAfterRender(async () => { await JsInvokeAsync<object>("matBlazor.matTextField.init", Ref); });
163169
}
164170
}
165-
}
171+
}

0 commit comments

Comments
 (0)