Skip to content

Commit 1b1d13f

Browse files
committed
add convenience parameters
1 parent 2c46f28 commit 1b1d13f

2 files changed

Lines changed: 27 additions & 3 deletions

File tree

src/Components/MudStaticRadio.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
<input id="@($"static-radio-{_elementId}")" tabindex="-1" @attributes="UserAttributes" type="radio" role="radio"
1111
class="mud-radio-input static-radio-input" checked="@_isChecked" disabled="@GetDisabledState()" name="@(_isChecked ? ParentGroup?.GroupName : "")" value="@Value"
1212
aria-checked="@(_isChecked.ToString().ToLower())" aria-disabled="@(GetDisabledState().ToString().ToLower())" @onclick:preventDefault="@GetReadOnlyState()" />
13-
<MudIcon Icon="@CheckedIcon" Color="HasErrors ? Color.Error : this.Color" Size="@Size" Disabled="@Disabled"
13+
<MudIcon Icon="@(ParentGroup.CheckedIcon ?? CheckedIcon)" Color="HasErrors ? Color.Error : ParentGroup?.Color ?? this.Color" Size="@Size" Disabled="@Disabled"
1414
id="@($"radio-checked-icon-{_elementId}")" style="@($"display: {_checkedStyle}")" />
15-
<MudIcon Icon="@UncheckedIcon" Color="HasErrors ? Color.Error : this.UncheckedColor ?? Color.Inherit" Size="@Size" Disabled="@Disabled"
16-
id="@($"radio-unchecked-icon-{_elementId}")" style="@($"display: {_uncheckedStyle}")" />
15+
<MudIcon Icon="@(ParentGroup.UncheckedIcon ?? UncheckedIcon)" Color="HasErrors ? Color.Error : ParentGroup?.UncheckedColor ?? this.UncheckedColor ?? Color.Inherit"
16+
Size="@Size" Disabled="@Disabled" id="@($"radio-unchecked-icon-{_elementId}")" style="@($"display: {_uncheckedStyle}")" />
1717
</span>
1818
@if (!string.IsNullOrEmpty(Label))
1919
{

src/Components/MudStaticRadioGroup.razor

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,30 @@
3333
[Parameter]
3434
public Expression<Func<T?>>? ValueExpression { get; set; }
3535

36+
/// <summary>
37+
/// The color to use when in an checked state
38+
/// </summary>
39+
[Parameter]
40+
public Color? Color { get; set; }
41+
42+
/// <summary>
43+
/// The color to use when in an unchecked state
44+
/// </summary>
45+
[Parameter]
46+
public Color? UncheckedColor { get; set; }
47+
48+
// /// <summary>
49+
// /// The icon displayed when in a checked state.
50+
// /// </summary>
51+
[Parameter]
52+
public string? CheckedIcon { get; set; }
53+
54+
// /// <summary>
55+
// /// The icon displayed when in an unchecked state.
56+
// /// </summary>
57+
[Parameter]
58+
public string? UncheckedIcon { get; set; }
59+
3660
public string GroupName { get; set; } = string.Empty;
3761
public T? SelectedValue { get; set; }
3862

0 commit comments

Comments
 (0)