Download the PHP package teofanis/searchable-dropdown without Composer
On this page you can find all versions of the php package teofanis/searchable-dropdown. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download teofanis/searchable-dropdown
More information about teofanis/searchable-dropdown
Files in teofanis/searchable-dropdown
Package searchable-dropdown
Short Description Searchable Dropdown
License MIT
Homepage https://github.com/teofanis/searchable-dropdown
Informations about the package searchable-dropdown
Searchable Dropdown
Searchable dropdown is a dropdown component built with Alpine JS, tailwind and Blade components. It can be used as a normal dropdown or a multiple selection dropdown.
Installation
You can install the package via composer:
Please note if you use Livewire 2.x you should install the 1.x version of the package.
Livewire 3.x
Publish the dropdowns' config and asset files
Finally add the dropdown styles and scripts in the head section of your layout file.
Usage
Here's an example of how you could use the dropdown inside your blade views.
Simple select & Multiselect
-Select
-Multiselect
Customization & Props
Props | Required | Context | Description | Type | Example |
---|---|---|---|---|---|
name | yes | any | Used as "name" attribute on input fields and used to internally by the dropdown | string | name="pizzaOptions" |
entangle | Required within Livewire components | Livewire | The dropdown will share its state with the "entangled" property of the Livewire components its rendered in. | string | entangle="pizzaToppings" |
context | Required within Livewire components | Livewire | The dropdown will use the context to setup the state-sharing with livewire component. (Won't be required in future release) | LW | :context="$this" |
inLivewire | Required within Livewire components | Livewire | Similarly to the context prop, this will be used in the initial setup of the component. (Won't be required in future release) | boolean | :in_live_wire="true" |
value | no | any | Used as any value attribute on input fields | string/array | value="old('name')" || :value="[1,2,3]" |
data | yes | any | Populates the dropdown list, collection keys will be returned for selections and values will be displayed. | Collection | :data="dataProvider()" |
xModel | no | Alpine | An option prop when you want to bind an apline js x-data field as a model of the dropdown. | string | x_model="modelName" |
multiselect | multiselect | any | Used to behave like a multiple option dropdown or a single option dropdown | boolean | :multiselect="true" |
alignListItems | no | any | Aligns the text on the dropdown list. You can pass a tailwind class for text-alignment e.g(text-left, text-right, text-center etc.) | string | align_items="text-left" |
disabled | no | any | Disable the dropdown interaction | boolean | :disabled="true" |
label | no | any | Displays the prop value as as label of the dropdown | string | label="My Dropdown Label" |
placeholder | no | any | Sets the placeholder text for the dropdown | string | placeholder="My Placeholder Text" |
searchFieldPlaceholder | no | any | Sets the placeholder for the search field | string | search_field_placeholder="My Search field Placeholder" |
noResultsMessage | no | any | Sets the message of the no-results block when filtering | string | no_results_message="No options found" |
Most props have default values set in config/searchable-dropdown-config.php that serve as a base for most use-cases.
Placeholder Defaults
Setting Defaults
Theme Styles
With the theme styles, you can do some small adjustments on color pallete of the dropdown as well as style the wrapper, label or button all using tailwind classes
To Fully customize the look & feel of the dropdown, publish the packages' views.
Testing
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Teofanis Papadopulos
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of searchable-dropdown with dependencies
illuminate/support Version ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
livewire/livewire Version ^3.0