@using Radzen
@using Microsoft.AspNetCore.Components.Forms
@inherits FormComponent<bool>
@if (Visible)
{
<label @ref="@Element" @attributes="Attributes" class="@GetCssClass()" id="@GetId()" style="@Style">
    <input type="checkbox" role="switch" name="@Name" id="@Name" checked="@Value"
           value="@ValueAsString" tabindex="@(Disabled || ReadOnly ? "-1" : $"{TabIndex}")"
           disabled="@(Disabled || ReadOnly)" aria-checked="@(Value.ToString().ToLowerInvariant())"
           @onclick="@Toggle" @onkeydown="@OnKeyPress"
           @onkeydown:stopPropagation="stopKeydownPropagation" class="rz-hidden-accessible" @attributes=@InputAttributes>
    <span class="rz-switch-circle@(Disabled ? " rz-disabled" : ReadOnly ? " rz-readonly" : "")"></span>
</label>
}
