Checks & switches

CheckBoxControl · RadioGroupControl · SwitchControl · RatingControl

Let users check items, switch options on, pick one of several or give a star rating.

Overview

The small Blazor inputs that most forms need: CheckBoxControl, SwitchControl, RadioGroupControl for one choice out of a few, and RatingControl for stars. Use checkboxes for a list users check off, where a select-all box can show that only some are checked, and a switch for a single option users turn on or off, such as Parking pass. All four bind their value two ways.

Examples

#Checkboxes with select all

Choose a new hire's optional benefits: with only some checked, the parent shows a dash (Indeterminate), and the monthly deduction follows every change; check the parent to set all three. The health plan is checked and Disabled.

Monthly deduction: $129

#Radio group and switches

Pick the new hire's work pattern, then switch Parking pass or Standing desk on and off; the line below reads your choices. Remote is a disabled item, and one switch is on and disabled.

Work pattern
Options

Hybrid; parking pass requested; standing desk not requested; laptop included.

#Rating

Click a star to rate onboarding week: each click adds a rating to the 8 already given. The line below shows the new average, and its ReadOnly stars show it rounded, so they move only when the rounded value changes.

Your rating of onboarding week
Not rated
Average 3.5 of 8 new hire ratings

Documentation

ParameterTypeDefaultDescription
CheckedboolfalseState. Two-way with @bind-Checked.
IndeterminateboolfalseDraws a dash and sets aria-checked="mixed". Visual only; Checked still decides what a click toggles to.
Labelstring?nullText after the box, inside the same <label>.
DisabledboolfalseDisables the input and dims the label.
CssClassstring?nullAppended to the label; fx-checkbox-theme-blue picks the native look.
TabIndexint?nullTab order of the input.
StopClickPropagation / StopMouseDownPropagation / StopKeyDownPropagationboolfalseStop those events reaching ancestors.
PreventKeyDownDefaultboolfalseCancels the browser's default for key presses on the input.
(no base class)—This control does not derive from FlexControlBase: no Enabled, Visible, Style or unmatched attributes.
An unhandled error has occurred. Reload 🗙

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.