Download the PHP package mrjokermr/livewire-multi-select without Composer
On this page you can find all versions of the php package mrjokermr/livewire-multi-select. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package livewire-multi-select
Livewire Multi Select
A simple, yet powerful, multi-select component for Livewire 3. It uses native inline CSS for out-of-the-box compatibility but is fully customizable with your own CSS classes.
Installation
Install the package via composer:
Publish the configuration file to customize the component's appearance and behavior. This is a recommended step.
This will create a config/multi-select.php file in your application.
Configuration
The published config/multi-select.php file allows you to set default behaviors and styling.
close_on_select_default: Determines if the dropdown should close automatically after selecting an option.display_input_error_default: Determines if by default input error messages should be displayed.css_classes: Define the CSS classes for each part of the component to match your project's design system (e.g., Tailwind CSS, Bootstrap).translations: Set the translation key for the "Selected" text displayed on the input. For example, you can set it to a key from your Laravel translation files.
Quick nav
- Usage & Examples
- Simple Array
- Eloquent Models
- Single Value Mode
- Search Functionality
- Livewire Events
- Pre-filtering with Base Query
- Usage with static forms (Without wire:model) & Error message handling
- Customization
- Customizing the Label
- Setting the Placeholder
- Enable/Disable input error display
- Overriding CSS Classes
- Close on Select Behavior
Usage & Examples
Simple Array
You can populate the select component with a simple associative array. The array key will be the option's value, and the array value will be the display label.
Use \Mrjokermr\LivewireMultiSelect\Classes\SelectSettings::simple() to create the settings.
Eloquent Models
Populate the options directly from an Eloquent model.
Use \Mrjokermr\LivewireMultiSelect\Classes\SelectSettings::eloquentModel() to define the source model and attributes.
Single Value Mode
To allow only a single selection, chain the ->singleValueMode() method. The wire:model property will hold a single value instead of an array.
Search Functionality
Enable a search input within the dropdown to filter options by chaining the ->enableSearch() method.
For Eloquent sources, you can specify additional attributes to search against.
In the config you might set the styling for search input element or use the method
Livewire Events
To handle value changes with Livewire events instead of wire:model, you can specify an event name. This is useful for triggering actions in parent components.
Pre-filtering with Base Query
When using eloquentModel, you can provide a baseQuery to apply a permanent filter to the available options.
Usage with static forms (Without wire:model) & Error message handling
When setting the name=, the input element will contain the input name. And also errors will be displayed.
Customization
You can customize each instance of the component using fluent methods.
Customizing the Label
Set a display label for the input. It can be omitted by not calling the method.
Setting the Placeholder
Change the 'selected' text or overwrite the 'translations.selected' configured in the config file
Enable/Disable input error display
You can configure this value in the config file but you might also change the behavior via:
Overriding CSS Classes
Override the default or configured CSS classes for a specific component instance. Any null values will fall back to the classes defined in config/multi-select.php.
Close on Select Behavior
Control whether the dropdown closes after an option is selected. The default is configured in config/multi-select.php.
->setCloseOnSelect(false) // Keep the dropdown open after selection