Class SfSwitch<TChecked>
Represents a Switch that toggles between checked (ON) and unchecked (OFF) states. Supports keyboard, mouse, and touch interactions, and integrates with form binding.
Implements
System.IAsyncDisposable
Inherited Members
Syncfusion.Blazor.Toolkit.Inputs.SfSelectionBase<TChecked>.CheckedChanged
Syncfusion.Blazor.Toolkit.Inputs.SfSelectionBase<TChecked>.CheckedExpression
Syncfusion.Blazor.Toolkit.Inputs.SfSelectionBase<TChecked>.ChildContent
Syncfusion.Blazor.Toolkit.Inputs.SfSelectionBase<TChecked>.HtmlAttributes
Namespace: Syncfusion.Blazor.Toolkit.Inputs
Assembly: Syncfusion.Blazor.Toolkit.dll
Syntax
public class SfSwitch<TChecked> : SfSelectionBase<TChecked>, IAsyncDisposable
Type Parameters
| Name | Description |
|---|---|
| TChecked | The type of the checked state value, typically bool. |
Constructors
SfSwitch()
Declaration
public SfSwitch()
Properties
OffLabel
Gets or sets the label text displayed when the Switch is in the OFF state.
Declaration
public string OffLabel { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | The label shown for the OFF state. Default: |
OnLabel
Gets or sets the label text displayed when the Switch is in the ON state.
Declaration
public string OnLabel { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | The label shown for the ON state. Default: |
ValueChange
Gets or sets the event callback that fires when the checked state changes through UI interaction.
Declaration
public EventCallback<CheckedChangeEventArgs<TChecked>> ValueChange { get; set; }
Property Value
| Type | Description |
|---|---|
| Microsoft.AspNetCore.Components.EventCallback<CheckedChangeEventArgs<TChecked>> | An Microsoft.AspNetCore.Components.EventCallback<> invoked when the value changes. |
Methods
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
| Type | Name | Description |
|---|---|---|
| Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder | __builder |
Implements
System.IAsyncDisposable