Label and Size in Blazor CheckBox Component

12 Aug 20211 minute to read

This section explains the different sizes and labels.

Label

The Checkbox caption can be defined by using the Label property. This reduces the manual addition of label for Checkbox. You can customize the label position before or after the Checkbox through the LabelPosition property.

@using Syncfusion.Blazor.Buttons

<SfCheckBox Label="Left Side Label" LabelPosition="LabelPosition.Before" @bind-Checked="isLeftChecked"></SfCheckBox><br />
<SfCheckBox Label="Right Side Label" LabelPosition="LabelPosition.After" @bind-Checked="isRightChecked"></SfCheckBox>

@code {
    private bool isLeftChecked = true;
    private bool isRightChecked = true;
}

Output be like

Blazor CheckBox with Label

Size

The different Checkbox sizes available are default and small. To reduce the size of default Checkbox to small, set the CssClass property to e-small.

@using Syncfusion.Blazor.Buttons

<SfCheckBox @bind-Checked="isSmallChecked" Label="Small" CssClass="e-small"></SfCheckBox><br />
<SfCheckBox @bind-Checked="isDefaultChecked" Label="Default"></SfCheckBox>

@code {
    private bool isSmallChecked = true;
     private bool isDefaultChecked = true;
}

<style>
    .e-checkbox-wrapper {
        margin-top: 18px;
    }
</style>

Output be like

Changing Blazor CheckBox Size

See Also