Display a checkbox with or without a label. The default checkbox colour is blue but there are nine colours available to choose from.
Like most of the BladewindUI components, checkboxes also come in nine colours to enable the components sit better in most designs with various colour schemes.
When using checkboxes with forms, it is always good practice to give the checkbox a name and value. That way, when the form is submitted, the value of the checkbox can be retrieved from its name. It is important to note that, in some cases, if the user does not select the checkbox, the name of the checkbox will be ignored completely from your payload.
The table below shows a comprehensive list of all the attributes available for the Checkbox component.
Option | Default | Available Values |
---|---|---|
name | checkbox | This name can be accessed when the checkbox is submitted in the form. The name is also available as part of the css classes. |
label | blank | Text to be displayed next to the checkbox. |
value | blank | In case you are editing a form, the value passed will be set on the value attribute of the checkbox.
<input type="checkbox" value="" ../> |
checked | false | Specifies whether the checkbox is checked or not. Value needs to be set as a string not boolean.true false |
disabled | false | Specifies whether the checkbox is disabled or not. Value needs to be set as a string not boolean.true false |
add_clearing | true | Adds a margin to the bottom of the checkbox to separate it from the next form element. Value needs to be set as a string not boolean.true false |
color | primary | Color of the checkbox rings.primary red yellow green blue black cyan
orange purple pink violet indigo fuchsia |
class | bw-checkbox | Any additional css classes can be added using this attribute. |
label_css | mr-6 | Applies styling to the checkbox label. |
resources > views > components > bladewind > checkbox.blade.php