Files
radzen-blazor/Radzen.Blazor/RadzenSwitch.razor
Frank 3e7468177d Added ReadOnly parameter for RadzenSwitch component (#1927)
* Added ReadOnly parameter for RadzenSwitch component

* Formatting
2025-01-29 08:57:29 +02:00

14 lines
767 B
Plaintext

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