marshmallow/boolean-group

A Laravel Nova field.

v1.1.0 2024-11-11 09:27 UTC

This package is auto-updated.

Last update: 2024-12-11 09:43:50 UTC


README

alt text

Nova Boolean Group

This package extends the default Boolean Group field from Nova 4. This package adds the ablity to use HTML in the labels. This is handy when you have a lot of information to show in your boolean group labels.

In the example below you can see the difference in behaviour between the default Boolean Group from Nova and the Boolean Group from this package.

Version Issues Code Coverage Licence

Installation

You can install the package via composer:

composer require marshmallow/boolean-group

Usage

The usage of this package could not be easier. You use it as you would use the BooleanGroup from Nova. Please check there documentation for all the cool stuff you can do with this field out of the box. The only addition is, you can now add HTML in your labels. This package will do the rest. Check out the example below. This is the code we’ve use to take the screenshots above.

use Marshmallow\BooleanGroup\BooleanGroup;

BooleanGroup::make(__('From Marshmallow'), 'field_3')->options([
    'option_1' => '<strong>Option 1</strong><br/><small>With HTML</small>',
    'option_2' => '<strong>Option 2</strong><br/><small>With HTML</small>',
    'option_3' => '<strong>Option 3</strong><br/><small>With HTML</small>',
]),

Click area

By default, the clickable area within the border is full width. This sometimes creates an issue where users click this area without the intention to check of uncheck anything. If you want to change this behaviour, you can do so with the method below.

use Marshmallow\BooleanGroup\BooleanGroup;

BooleanGroup::make(__('From Marshmallow'), 'field_3')->options([
    // ...
])->cancelFullWidth(),

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

composer test

Security

If you discover any security related issues, please email stef@marshmallow.dev instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.