Blazorise Check component
Check allow the user to toggle an option on or off.
The <Check>
component provides users the ability to choose between two distinct values. These are very similar to a switch and can be used in complex forms and checklists. You can use this to supply a way for the user to toggle an option.
Check
Simple card<Check TValue="bool">Check me out</Check>
With name
This example showcases two Blazorise checkboxes linked to the same identifier, CheckMeOut. Both checkboxes contribute to the same data field upon submission when included in a form. This setup is ideal for grouping related choices under one name but requires careful data handling to distinguish between the choices on the server side.<Check TValue="bool" Name="">Check me out</Check> <Check TValue="bool" Name="">Check me out too!</Check>
@code{ string name = "CheckMeOut"; }
Usage
With bind attribute
<Check TValue="bool" @bind-Checked="">Remember Me</Check>
@code{ bool rememberMe; }
With event
<Check TValue="bool" Checked="" CheckedChanged="">Remember Me</Check>
@code{ bool rememberMe; void OnRememberMeChanged( bool value ) { rememberMe = value; } }
API
Attributes
Name | Description | Type | Default |
---|---|---|---|
TValue |
Data type of Checked value. Support types are bool and bool? .
|
generic | |
Checked |
Gets or sets the checked flag. | TValue | default |
CheckedChanged |
Occurs when the check state is changed. | EventCallback<TValue> | |
Indeterminate |
The indeterminate property can help you to achieve a ‘check all’ effect. | bool? | null |
Inline |
Group checkboxes on the same horizontal row. | bool | false |
Cursor |
Defines the mouse cursor based on the behavior by the current CSS framework. | Cursor | Default |
Name |
Defines the name attribute of a checkbox. The name attribute is used to identify form data after it has been submitted to the server, or to reference form data using JavaScript on the client side. | Cursor | Default |