Switch

The ArcadiaSwitch component renders an accessible toggle switch built on a native checkbox with role="switch".

Basic Usage

<ArcadiaSwitch @bind-Value="enabled" Label="Enable notifications" />

<ArcadiaSwitch @bind-Value="darkMode" OnLabel="On" OffLabel="Off" Color="success" />

<ArcadiaSwitch @bind-Value="feature" Size="lg" Disabled="true" />

Parameters

ParameterTypeDefaultDescription
ValueboolfalseWhether the switch is on. Supports two-way binding.
Labelstring?nullLabel text displayed next to the switch.
OnLabelstring?nullText displayed inside the switch when on.
OffLabelstring?nullText displayed inside the switch when off.
DisabledboolfalseWhether the switch is disabled.
Sizestring"md"Size: "sm", "md", "lg".
Colorstring"primary"Color theme: "primary", "success", "warning", "danger".
Classstring?nullAdditional CSS class names.
Stylestring?nullInline CSS styles.

Events

EventTypeDescription
ValueChangedEventCallback<bool>Fired when the switch value changes.

Accessibility

  • Uses a native <input type="checkbox"> with role="switch" and aria-checked.
  • Wrapped in a <label> for click-to-toggle.
  • Provides aria-label from the Label parameter.
  • Native keyboard support: Space to toggle.