lucasgiovanny/filament-multiselect-two-sides

This package is a Filament package that allows you to create a multiselect with two sides.

v3.0.0-alpha 2024-03-13 15:07 UTC

README

Latest Version on Packagist Total Downloads

This package is a Filament plugin that allows you to create a multiselect with two sides.

Filament Multiselector Two Sides

Example

Example of plugin

Installation

You can install the package via composer:

composer require lucasgiovanny/filament-multiselect-two-sides

Optionally, you can publish the translations:

php artisan vendor:publish --tag="filament-multiselect-two-sides-translations"

Usage

use LucasGiovanny\FilamentMultiselectTwoSides\Forms\Components\Fields\MultiselectTwoSides;

return $form
    ->schema([
        MultiselectTwoSides::make('roles')
            ->options([
                'admin'   => 'Admin',
                'manager' => 'Manager',
                'user'    => 'User',
            ]),
    ]);

Setting labels

MultiselectTwoSides::make('roles')
    ->options([
        
        'admin'   => 'Admin',
        'manager' => 'Manager',
        'user'    => 'User',
    ]
    ])
    ->selectableLabel('Available Roles')
    ->selectedLabel('Selected Roles'),

Enabling the search

By default, the search is disabled. To enable it, use the enableSearch method.

MultiselectTwoSides::make('roles')
    ->options([
        'admin'   => 'Admin',
        'manager' => 'Manager',
        'user'    => 'User',
    ])
    ->enableSearch(),

Setting the default selected options

MultiselectTwoSides::make('roles')
    ->options([
        'admin'   => 'Admin',
        'manager' => 'Manager',
        'user'    => 'User',
    ])
    ->default(['admin', 'manager']),

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

License

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