Search results

Label and Size in ASP.NET Core CheckBox control

20 Apr 2021 / 1 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.

tagHelper
label.cs
Copied to clipboard
<ul>
    <li>
        <ejs-checkbox id="cbox1" label="Left Side Label" labelPosition="@Syncfusion.EJ2.Buttons.LabelPosition.Before"></ejs-checkbox>
    </li>
    <li>
        <ejs-checkbox id="cbox2" label="Right Side Label" labelPosition="@Syncfusion.EJ2.Buttons.LabelPosition.After" checked="true"></ejs-checkbox>
    </li>
</ul>
<style>
    .e-checkbox-wrapper {
        margin-top: 18px;
    }

    li {
        list-style: none;
    }
</style>
Copied to clipboard
public ActionResult Label()
{
    return View();
}

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.

tagHelper
size.cs
Copied to clipboard
<ul>
    <li>
        <ejs-checkbox id="cbox1" label="Small" cssClass="e-small"></ejs-checkbox>
    </li>
    <li>
        <ejs-checkbox id="cbox2" label="Default"></ejs-checkbox>
    </li>
</ul>

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

    li {
        list-style: none;
    }
</style>
Copied to clipboard
public ActionResult Size()
{
    return View();
}

See Also

Contents
Contents