Check Box

Checkboxes are a great way to allow the user to make a selection of choices from things like a list. If you want to let the user turn a setting on or off on demand, a Switch component is recommended instead.

Basic Checkboxes

<MudCheckBox @bind-Value="Basic_CheckBox1"></MudCheckBox>
<MudCheckBox @bind-Value="Basic_CheckBox2" Color="Color.Primary"></MudCheckBox>
<MudCheckBox @bind-Value="Basic_CheckBox3" Color="Color.Secondary"></MudCheckBox>
<MudCheckBox @bind-Value="Basic_CheckBox4" Disabled="true"></MudCheckBox>
@code {
    public bool Basic_CheckBox1 { get; set; } = true;
    public bool Basic_CheckBox2 { get; set; } = false;
    public bool Basic_CheckBox3 { get; set; } = false;
    public bool Basic_CheckBox4 { get; set; } = true;
}
Color

<MudCheckBox @bind-Value="Basic_CheckBox1" UnCheckedColor="Color.Error"></MudCheckBox>
<MudCheckBox @bind-Value="Basic_CheckBox2" Color="Color.Primary" UnCheckedColor="Color.Default"></MudCheckBox>
<MudCheckBox @bind-Value="Basic_CheckBox3" Color="Color.Secondary" UnCheckedColor="Color.Default"></MudCheckBox>
<MudCheckBox @bind-Value="Basic_CheckBox4" Disabled="true" UnCheckedColor="Color.Success"></MudCheckBox>
@code {
    public bool Basic_CheckBox1 { get; set; } = true;
    public bool Basic_CheckBox2 { get; set; } = false;
    public bool Basic_CheckBox3 { get; set; } = false;
    public bool Basic_CheckBox4 { get; set; } = true;
}
Labels

Text can be added using the Label property and its position can be specified using the LabelPosition property

<MudCheckBox @bind-Value="Label_CheckBox1" Label="Default"></MudCheckBox>
<MudCheckBox @bind-Value="Label_CheckBox2" Label="Primary" Color="Color.Primary"></MudCheckBox>
<MudCheckBox @bind-Value="Label_CheckBox3" Label="Secondary" LabelPosition="LabelPosition.Start" Color="Color.Secondary"></MudCheckBox>
<MudCheckBox @bind-Value="Label_CheckBox1" Disabled="true" Label="Disabled" LabelPosition="LabelPosition.Start"></MudCheckBox>
@code {
    public bool Label_CheckBox1 { get; set; } = true;
    public bool Label_CheckBox2 { get; set; } = false;
    public bool Label_CheckBox3 { get; set; } = false;
}

Copyright © 2020-2024 MudBlazor.

Powered by .NET 8.0.8

An error has occurred. This application may no longer respond until reloaded. Reload 🗙