You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Connected.Components/Components/CheckBox/CheckBox.razor

25 lines
1.4 KiB

@namespace Connected.Components
@inherits BooleanInput<T>
@typeparam T
<InputControl Class="@Classname" Style="@Style" Error="@HasErrors" ErrorText="@GetErrorText()" Required="@Required">
<InputContent>
<label class="@LabelClassname" id="@_elementId" @onkeydown="HandleKeyDown" @onclick:stopPropagation="@StopClickPropagation">
<span tabindex="0" class="@CheckBoxClassname">
@*note: stopping the click propagation is important here. otherwise checking the checkbox results in click events on its parent (i.e. table row), which is generally not what you would want*@
<input tabindex="-1" @attributes="UserAttributes" type="checkbox" class="mud-checkbox-input" checked="@BoolValue" @onchange="@OnChange" disabled="@Disabled" @onclick:preventDefault="@ReadOnly" />
<Icon Icon="@GetIcon()" Color="HasErrors ? ThemeColor.Error : ThemeColor.Inherit" Size="@Size" />
</span>
@if (!String.IsNullOrEmpty(Label))
{
<TextContent Color="HasErrors ? ThemeColor.Error : ThemeColor.Inherit">@Label</TextContent>
}
@if (ChildContent != null)
{
<TextContent Color="HasErrors ? ThemeColor.Error : ThemeColor.Inherit">
@ChildContent
</TextContent>
}
</label>
</InputContent>
</InputControl>