CheckboxInput


The CheckboxInput component is used to capture a boolean choice with Bulma's native checkbox styling and Blazor data binding.

API Documentation

How it works #

The CheckboxInput component wraps a native checkbox in Bulma's checkbox label pattern, making it easy to combine checked-state binding with inline label content.

How to use:
  1. Add the CheckboxInput component to your page.
  2. Bind its Value property with @bind-Value.
  3. Place the label text or other inline content between the opening and closing tags.
This demo shows the basic checked-state binding and inline label content of the CheckboxInput component.
Selected value: True
<CheckboxInput @bind-Value="rememberMe">
    Remember me
</CheckboxInput>
<div class="mt-2">Selected value: @rememberMe</div>

@code {
    private bool rememberMe = true;
}

Disabled #

The CheckboxInput component can be disabled to prevent user interaction while still displaying its checked state and label.

How to use:
  1. Add the CheckboxInput component to your page.
  2. Set Disabled="true" to make the checkbox non-interactive.
  3. Provide the label content between the component tags as usual.
This demo shows how to render the CheckboxInput component in a disabled state.
<CheckboxInput Value="true" Disabled="true">
    Save my preferences
</CheckboxInput>

Events: ValueChanged #

The CheckboxInput component exposes a ValueChanged event, allowing you to react whenever the checkbox is checked or unchecked.

How to use:
  1. Set the Value parameter to the current checked state.
  2. Handle the ValueChanged callback to update your logic when the value changes.
  3. Use the updated value elsewhere in your UI as needed.
This demo shows how to handle the checked-state change using the ValueChanged event.
Selected value: False
<CheckboxInput Value="@acceptedTerms" ValueChanged="OnValueChanged">
    I agree to the terms and conditions
</CheckboxInput>
<div class="mt-2">Selected value: @acceptedTerms</div>

@code {
    private bool acceptedTerms;

    private void OnValueChanged(bool value)
    {
        acceptedTerms = value;
    }
}
DO YOU KNOW?
This demo website is built using the BlazorExpress.Bulma library and published on the Azure Web App. See our source code on GitHub.