wabbajack/Wabbajack.App.Blazor/Components/OptionCheckbox.razor
2022-01-28 12:58:28 +01:00

30 lines
734 B
Plaintext

@namespace Wabbajack.App.Blazor.Components
<label class="option">
@Label
<input type="checkbox" value="@IsChecked" @onchange="CheckBoxChanged">
<span class="checkmark"></span>
</label>
@code {
// TODO: [Low] Implement parameters to customize style.
[Parameter]
public string? Label { get; set; }
[Parameter]
public bool IsChecked { get; set; }
[Parameter]
public EventCallback<bool> IsCheckedChanged { get; set; }
private async Task CheckBoxChanged(ChangeEventArgs e)
{
if (e.Value is not bool newValue) return;
if (IsChecked == newValue) return;
IsChecked = newValue;
await IsCheckedChanged.InvokeAsync(IsChecked);
}
}