Download the PHP package sertxudeveloper/livewire-combobox without Composer
On this page you can find all versions of the php package sertxudeveloper/livewire-combobox. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sertxudeveloper/livewire-combobox
More information about sertxudeveloper/livewire-combobox
Files in sertxudeveloper/livewire-combobox
Package livewire-combobox
Short Description Add combobox to your Livewire forms
License MIT
Homepage https://github.com/sertxudeveloper/livewire-combobox
Informations about the package livewire-combobox
Add combobox to your Livewire forms
Do you have a large dataset, and you need to be able to display it in a dropdown?
When a basic select input is not enough, you can use a combobox!
A combobox works like a select input, but instead of a dropdown, it displays a list of options that can be filtered by typing.
You will no longer need to download all the data at the startup, just get the data you're looking for.
Installation
You can install the package via composer:
Usage
Once you have installed the package, you can use it in your Livewire forms.
First, you need to execute the following command in your terminal:
This will create a new component in the app/Livewire
directory.
The new UsersCombobox
component will look like this:
As you can see, the $model
property is set to the User
model.
This means that the component will be able to query the database using this model.
By default, the component will display the name
column of the model.
You can change this by setting the labelColumn
property:
To start using the component, you need to add it to your Livewire form.
You can also pass some parameters to the component:
[!WARNING] If you don't pass any parameters, the component will use the default values.
It's recommended to pass the parameters to the component.
You can also add the values overriding the default values in the class.
Events
While interacting with the component, some events might be fired.
The name of the events depends on the component name, this allows you to have more than one combobox in your form.
selected-<component-name>
: When the user selects an option from the dropdown.cleared-<component-name>
: When the user clears the selected option.
These events will be fired up, so the parent component can react to the user interaction.
[!Note] The
selected
event contains the selected model as a parameter.
Adding filters
You can filter the results by adding filters to the component.
The filter
method receives the query builder as a parameter, so you can add as many filters as you want.
The filters will be applied to the query before fetching the results, so you can use them to limit the options given to the user.
Testing
This package contains tests, you can run them using the following command:
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Sergio Peris
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
Copyright © 2022 Sertxu Developer
All versions of livewire-combobox with dependencies
livewire/livewire Version ^3.1
illuminate/contracts Version ^10.0|^11.0
illuminate/database Version ^10.0|^11.0
illuminate/support Version ^10.0|^11.0