Inputs

Checkbox Group

{note} You're browsing the documentation for an old version of laravel-form-components. Consider upgrading your project to v8. Check your version with the following command:

composer show rawilk/laravel-form-components

The checkbox group allows you to quickly group related checkboxes or radio buttons together in your forms. This is not a replacement for the form-group component, and should be used inside of the form-group component in your forms.

The most basic usage is like this:

<x-checkbox-group>
    checkbox 1
    checkbox 2
</x-checkbox-group>

This will output:

<div class="space-y-4">
    checkbox 1
    checkbox 2
</div>

By default, the checkbox-group is designed to stack your checkboxes and radio inputs, but you can display them inline with each other, by setting the stacked attribute to false. This will display the checkboxes in rows of 3 columns.

<x-checkbox-group :stacked="false">
    checkbox 1
    checkbox 2
</x-checkbox-group>

This will output:

<div class="form-checkbox-group">
    checkbox 1
    checkbox 2
</div>

If you want a different amount of columns for your groups, you should override the .form-checkbox-group class in your stylesheets.

Previous
Email
Caught a mistake? Suggest an edit on GitHub