Skip to content

Commit 3b580fa

Browse files
authored
InputStyler Label (#135)
1 parent d35c209 commit 3b580fa

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

CodeBeam.MudExtensions/Components/InputStyler/MudInputStyler.razor

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@
3434
[Category(CategoryTypes.Item.Appearance)]
3535
public string TextColor { get; set; }
3636

37+
/// <summary>
38+
/// The label style. Add !important if style doesn't applied.
39+
/// </summary>
40+
[Parameter]
41+
[Category(CategoryTypes.Item.Appearance)]
42+
public string LabelStyle { get; set; }
43+
3744
/// <summary>
3845
/// The label text color. Supports hex values "#ffffff", valid keywords "blue" and CSS variables "var(--mud-palette-primary)"
3946
/// </summary>
@@ -122,4 +129,6 @@
122129
}</MudRender>
123130
}
124131
}
132+
133+
@($"{Selector} .mud-input-label {{ {LabelStyle} }}")
125134
</style>

ComponentViewer.Docs/Pages/Examples/InputStylerExample1.razor

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@using MudBlazor.Utilities
2-
<MudGrid Style="background-color: var(--mud-palette-background-grey)">
3-
<MudItem xs="12" sm="8">
2+
<MudGrid >
3+
<MudItem xs="12" sm="8" Style="background-color: var(--mud-palette-background-grey)">
44
<MudStack>
55
<MudText>Default TextFields</MudText>
66
<MudStack Row="true">
@@ -31,7 +31,7 @@
3131
</MudStack>
3232

3333
<MudInputStyler Selector=".text-field" BaseColor="@(_baseColor?.ToString())" TextColor="@(_textColor?.ToString())" LabelColor="@(_labelColor?.ToString())"
34-
BorderColor="@(_borderColor?.ToString())" Always="_always" />
34+
BorderColor="@(_borderColor?.ToString())" LabelStyle="@_labelStyle" Always="_always" />
3535
<MudInputStyler Selector=".label-background-grey" LabelBackgroundColor="@("var(--mud-palette-background-grey)")" />
3636
<MudInputStyler Selector=".label-background-transparent" LabelBackgroundColor="transparent" />
3737
<MudInputStyler />
@@ -44,6 +44,7 @@
4444
<MudColorPicker @bind-Value="_textColor" Label="Text Color" ColorPickerView="ColorPickerView.Grid" Clearable="true" />
4545
<MudColorPicker @bind-Value="_labelColor" Label="Label Color" ColorPickerView="ColorPickerView.Grid" Clearable="true" />
4646
<MudColorPicker @bind-Value="_borderColor" Label="Border Color" ColorPickerView="ColorPickerView.Grid" Clearable="true" />
47+
<MudTextField @bind-Value="_labelStyle" Label="Label Style" Variant="Variant.Outlined" />
4748
<MudButton OnClick="Reset">Reset</MudButton>
4849
</MudStack>
4950
</MudItem>
@@ -55,6 +56,7 @@
5556
MudColor _labelColor;
5657
MudColor _borderColor;
5758
bool _always;
59+
string _labelStyle;
5860

5961
private void Reset()
6062
{

0 commit comments

Comments
 (0)