Switch
A control that allows the user to toggle between checked and not checked states. A simple switch component with an associated label. For better form structure and accessibility, compose the `RzSwitch` within a `Field` component. Use `Orientation="FieldOrientation.Horizontal"` to layout the elements in a row.<EditForm Model="@_model">
<div class="flex items-center space-x-2">
<RzSwitch For="@(() => _model.AirplaneMode)" Id="airplane-mode" />
<Label for="airplane-mode">Airplane Mode</Label>
</div>
</EditForm><EditForm Model="@_model">
<Field Orientation="FieldOrientation.Horizontal" class="justify-between rounded-lg border p-4">
<div class="space-y-0.5">
<FieldLabel For="@(() => _model.MarketingEmails)">Marketing emails</FieldLabel>
<FieldDescription>
Receive emails about new products, features, and more.
</FieldDescription>
</div>
<RzSwitch For="@(() => _model.MarketingEmails)" />
</Field>
</EditForm>Property Type Default Description ForExpression<Func<bool>>Required An expression that identifies the bound boolean value. Valuebool?nullThe current value of the switch. DisplayNamestring?nullThe display name for the input, used for validation messages and labels if not otherwise specified. AriaLabelstring?"Toggle switch" The accessible label for the switch, announced by screen readers.