Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Filament Combobox Laravel Package

novadaemon/filament-combobox

View on GitHub
Deep Wiki
Context7

novadaemon/filament-combobox

Side by side combobox multiselect field to use in your FilamentPHP forms.

Installation

You can install the package via composer:

composer require novadaemon/filament-combobox

This package supports Filament 3.x and 4.x

Usage

Simply use the component as you'd use any other Filament field. It's especially perfect for the resource view page where it blends right in.

use Novadaemon\FilamentCombobox\Combobox;

class FileResource extends Resource
{
    public static function form(Form $form): Form
    {
        return $form
            ->schema([
                Combobox::make('vegetables')
                ->options([
                    'carrot' => 'Carrot',
                    'potato' => 'Potato',
                    'tomato' => 'Tomato',
                ])
            ]);
    }
}

Since the Combobox component extends the Filament\Forms\Components\Select class, it is possible to use almost all methods of the parent component.

Integrating with an Eloquent relationship

use Novadaemon\FilamentCombobox\Combobox;

class FileResource extends Resource
{
    public static function form(Form $form): Form
    {
        return $form
            ->schema([
                Combobox::make('categories')
                ->relationship('categories', 'name')
            ]);
    }
}

Customize

Enabling search in the boxes

use Novadaemon\FilamentCombobox\Combobox;

class FileResource extends Resource
{
    public static function form(Form $form): Form
    {
        return $form
            ->schema([
                Combobox::make('categories')
                ->relationship('categories', 'name')
                ->boxSearchs()
            ]);
    }
}

The boxSearchs method accepts a boolean or closure callback function.

class FileResource extends Resource
{
    public static function form(Form $form): Form
    {
        return $form
            ->schema([
                Combobox::make('categories')
                ->relationship('categories', 'name')
                ->boxSearchs(fn() => auth()->user()->isAdmin())
            ]);
    }
}

Modifying the height of the component

Yo can change the height of the component using the height method:

class FileResource extends Resource
{
    public static function form(Form $form): Form
    {
        return $form
            ->schema([
                Combobox::make('categories')
                ->relationship('categories', 'name')
                ->height('500px')
            ]);
    }
}

Customize the label of the boxes

Changing the label of the boxes:

class FileResource extends Resource
{
    public static function form(Form $form): Form
    {
        return $form
            ->schema([
                Combobox::make('categories')
                ->relationship('categories', 'name')
                ->optionsLabel('Available categories')
                ->selectedLabel('Selected categories')
            ]);
    }
}

Hiding the label on the boxes:

class FileResource extends Resource
{
    public static function form(Form $form): Form
    {
        return $form
            ->schema([
                Combobox::make('categories')
                ->relationship('categories', 'name')
                ->showLabels(false)
            ]);
    }
}

Translations

Optionally, you can publish the translations using

php artisan vendor:publish --tag="filament-combobox-translations"

Now, yo can modify or add custom translation files.

Contributing

Contributing is pretty chill and is highly appreciated! Just send a PR and/or create an issue!

Credits

License

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

Screenshot

Screenshot

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle