PHPackages                             defstudio/filament-searchable-input - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. defstudio/filament-searchable-input

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

defstudio/filament-searchable-input
===================================

A searchable autocomplete input for Filament forms

v5.0.2(3mo ago)3421.9k↑11%7[4 issues](https://github.com/defstudio/filament-searchable-input/issues)MITPHPPHP ^8.3CI passing

Since Mar 24Pushed 1w ago3 watchersCompare

[ Source](https://github.com/defstudio/filament-searchable-input)[ Packagist](https://packagist.org/packages/defstudio/filament-searchable-input)[ Docs](https://github.com/defstudio/filament-searchable-input)[ Fund](https://paypal.me/defstudiosrl)[ GitHub Sponsors](https://github.com/defstudio)[ RSS](/packages/defstudio-filament-searchable-input/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (10)Dependencies (31)Versions (41)Used By (0)

Filament Searchable Input
=========================

[](#filament-searchable-input)

[![Latest Version on Packagist](https://camo.githubusercontent.com/de1b6fd2350c18c7c16ff5157f00c7db7ae8660974b74fa2b132396c1ec90e08/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64656673747564696f2f66696c616d656e742d73656172636861626c652d696e7075742e737667)](https://packagist.org/packages/defstudio/filament-searchable-input)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/9209a15c6bd9f211c92411fd1a5586666d4e2a7284899018a07dc6d600502c3b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f64656673747564696f2f66696c616d656e742d73656172636861626c652d696e7075742f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65)](https://github.com/defstudio/filament-searchable-input/actions/workflows/fix-php-code-style-issues.yml?query=workflow%3Afix-php-code-style-issues+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/7dafd2539d0b648409708f1f6291a5fb9e9dbe8584a3d43acc8d56462e5b798c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64656673747564696f2f66696c616d656e742d73656172636861626c652d696e7075742e737667)](https://packagist.org/packages/defstudio/filament-searchable-input)

A searchable autocomplete input for Filament

[![image](https://private-user-images.githubusercontent.com/8792274/426224305-6e85aa0e-13b5-4776-ae96-b3abc23d9f5f.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODI5NzE5OTAsIm5iZiI6MTc4Mjk3MTY5MCwicGF0aCI6Ii84NzkyMjc0LzQyNjIyNDMwNS02ZTg1YWEwZS0xM2I1LTQ3NzYtYWU5Ni1iM2FiYzIzZDlmNWYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDcwMiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjA3MDJUMDU1NDUwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MGE2YzBmYTFiYWZkMmVlMzlmZGQzODAzYTk4NTJhMWE2NGVjNDY0MWY0ODUzODY3YjBkOWNlNTEyY2FmOTZkOSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmcmVzcG9uc2UtY29udGVudC10eXBlPWltYWdlJTJGcG5nIn0.lWe3dKL_GVjYFC8hFqk-JNxAayQ8aPDCBNuv7w60ZfQ)](https://private-user-images.githubusercontent.com/8792274/426224305-6e85aa0e-13b5-4776-ae96-b3abc23d9f5f.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODI5NzE5OTAsIm5iZiI6MTc4Mjk3MTY5MCwicGF0aCI6Ii84NzkyMjc0LzQyNjIyNDMwNS02ZTg1YWEwZS0xM2I1LTQ3NzYtYWU5Ni1iM2FiYzIzZDlmNWYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDcwMiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjA3MDJUMDU1NDUwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MGE2YzBmYTFiYWZkMmVlMzlmZGQzODAzYTk4NTJhMWE2NGVjNDY0MWY0ODUzODY3YjBkOWNlNTEyY2FmOTZkOSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmcmVzcG9uc2UtY29udGVudC10eXBlPWltYWdlJTJGcG5nIn0.lWe3dKL_GVjYFC8hFqk-JNxAayQ8aPDCBNuv7w60ZfQ)

    demo.webm    Filament Compatibility
----------------------

[](#filament-compatibility)

Package VersionFilament Version1.x3.x4.x4.x5.x5.xInstallation
------------

[](#installation)

You can install the package via composer:

```
composer require defstudio/filament-searchable-input
```

Important

If you have not set up a custom theme and are using Filament Panels follow the instructions in the [Filament Docs](https://filamentphp.com/docs/4.x/styling/overview#creating-a-custom-theme) first.

After setting up a custom theme add the plugin's views to your theme css file or your app's css file if using the standalone packages.

```
@source '../../../../vendor/defstudio/filament-searchable-input/resources/**/*.blade.php';
```

Views customization
-------------------

[](#views-customization)

Optionally, you can publish the views using

```
php artisan vendor:publish --tag="filament-searchable-input-views"
```

Usage
-----

[](#usage)

`SearchableInput` is a component input built on top of TextInput, so any TextInput method is available, plus it allows to define a search function that will be executed whenever the user types something.

Here's a basic implementation

```
use DefStudio\SearchableInput\Forms\Components\SearchableInput;

class ProductResource
{
    public static function form(Form $form): Form
    {
        return $form->schema([
            SearchableInput::make('description')
                ->options([
                    'Lorem ipsum dolor',
                    'Aspernatur labore qui fugiat',
                    'Dolores tempora libero assumenda',
                    'Qui rem voluptas officiis ut non',

                    //..

                ])
        ]);
    }
}
```

### Value-Label pairs options

[](#value-label-pairs-options)

Options can be defined also as an array of Value and Label pairs.

The `Value` will be inserted in the Input field when the user select an item. The `Label` is just used as a display value inside the search dropdown.

```
use DefStudio\SearchableInput\Forms\Components\SearchableInput;

class ProductResource
{
    public static function form(Form $form): Form
    {
        return $form->schema([
            SearchableInput::make('description')
                ->options([
                    'Lorem ipsum dolor' => '[A001] Lorem ipsum dolor.',
                    'Aspernatur labore qui fugiat' => '[A001] Aspernatur labore qui fugiat.',
                    'Dolores tempora libero assumenda' => '[A002] Dolores tempora libero assumenda.',
                    'Qui rem voluptas officiis ut non' => '[A003] Qui rem voluptas officiis ut non.',

                    //..

                ])
        ]);
    }
}
```

Custom Search Function
----------------------

[](#custom-search-function)

Instead (or along with) defining an `->options()` set, the search result set can be customized:

```
use DefStudio\SearchableInput\Forms\Components\SearchableInput;

class ProductResource
{
    public static function form(Form $form): Form
    {
        return $form->schema([
            SearchableInput::make('description')
                ->searchUsing(function(string $search){

                    return Product::query()
                        ->where('description', 'like', "%$search%")
                        ->orWhere('code', 'like', "%$search%")
                        ->limit(15)
                        ->pluck('description')
                        ->values()
                        ->toArray();

                    // Or, an associative array as well...

                    return Product::query()
                        ->where('description', 'like', "%$search%")
                        ->orWhere('code', 'like', "%$search%")
                        ->limit(15)
                        ->mapWithKeys(fn(Product $product) => [
                            $product->description => "[$product->code] $product->description"
                        ])
                        ->toArray();

                    // Or, also, an array of complex items (see below)
                })
        ]);
    }
}
```

Complex Items
-------------

[](#complex-items)

`SearchableInput` supports using arrays as search results, this allows to pass metadata to the selected item and consume it in the `->onItemSelected()` method:

```
use DefStudio\SearchableInput\Forms\Components\SearchableInput;
use DefStudio\SearchableInput\DTO\SearchResult;

class ProductResource
{
    public static function form(Form $form): Form
    {
        return $form->schema([
            SearchableInput::make('description')
                ->searchUsing(function(string $search){

                    return Product::query()
                        ->where('description', 'like', "%$search%")
                        ->limit(15)
                        ->map(fn(Product $product) => SearchResult::make($product->description, "[$product->code] $product->description")
                            ->withData('product_id', $product->id)
                            ->withData('product_code', $product->code)
                        )
                        ->toArray()

                })
                ->onItemSelected(function(SearchResult $item){
                    $item->value();
                    $item->label();
                    $item->get('product_id');
                    $item->get('product_code');
                }),
        ]);
    }
}
```

Filament Utility Injection
--------------------------

[](#filament-utility-injection)

In each of its methods, `SearchableInput` fully supports Filament utility injection in its methods, like:

```
 SearchableInput::make('description')
    ->searchUsing(function(string $search, array $options){ //options defined in ->options([...])
        //...
    })
    ->searchUsing(function(string $search, Get $get, Set $set){ //$get and $set utilities
        //...
    })
    ->searchUsing(function(string $search, $state){ //current field state
        //...
    })
     ->searchUsing(function(string $search, Component $component){ //current component instance
        //...
    })
     ->searchUsing(function(string $search, ?Model $record){ //current form record
        //...
    })
     ->searchUsing(function(string $search, string $operation){ //current form operation (create/update)
        //...
    });

```

Upgrading
---------

[](#upgrading)

### From v1.x (Filament v3) to v4.x (Filament v4)

[](#from-v1x-filament-v3-to-v4x-filament-v4)

With Filament v4 it has been recommended for plugin authors to have the users include their plugins views in a custom theme, rather than include the built css from the plugin. So for upgrades from Filament v3 to v4 it is recommended to follow these instructions from [Filament Docs](https://filamentphp.com/docs/4.x/styling/overview#creating-a-custom-theme) to set up a custom theme (if not already done) and add this to your theme/app css file

```
@source '../../../../vendor/defstudio/filament-searchable-input/resources/**/*.blade.php';
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](.github/SECURITY.md) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Fabio Ivona](https://github.com/fabio-ivona)
- [Mario Gattolla](https://github.com/MarioGattolla)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

56

—

FairBetter than 97% of packages

Maintenance88

Actively maintained with recent releases

Popularity40

Moderate usage in the ecosystem

Community17

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 73.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~10 days

Recently: every ~50 days

Total

37

Last Release

109d ago

Major Versions

v0.0.1 → v1.0.02025-03-24

v1.0.16 → v4.0.0-beta12025-08-18

v4.x-dev → v5.0.12026-02-24

PHP version history (3 changes)v0.0.1PHP ^8.1

v4.0.0-beta1PHP ^8.2

v5.0.2PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/db5e0ab5568062368a52c61d67381c1a35be5e5c816968dd3883bc7ba2d46b53?d=identicon)[fabio.ivona](/maintainers/fabio.ivona)

---

Top Contributors

[![fabio-ivona](https://avatars.githubusercontent.com/u/8792274?v=4)](https://github.com/fabio-ivona "fabio-ivona (128 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (19 commits)")[![MarioGattolla](https://avatars.githubusercontent.com/u/94918437?v=4)](https://github.com/MarioGattolla "MarioGattolla (15 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (11 commits)")[![zvizvi](https://avatars.githubusercontent.com/u/4354421?v=4)](https://github.com/zvizvi "zvizvi (1 commits)")

---

Tags

laravelsearchableinputFormsfilamentfilamentphpdefstudio

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/defstudio-filament-searchable-input/health.svg)

```
[![Health](https://phpackages.com/badges/defstudio-filament-searchable-input/health.svg)](https://phpackages.com/packages/defstudio-filament-searchable-input)
```

###  Alternatives

[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

329530.5k29](/packages/codewithdennis-filament-select-tree)[relaticle/custom-fields

User Defined Custom Fields for Laravel Filament

16354.2k](/packages/relaticle-custom-fields)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[dotswan/filament-map-picker

Easily pick and retrieve geo-coordinates using a map-based interface in your Filament applications.

128192.3k3](/packages/dotswan-filament-map-picker)[stephenjude/filament-feature-flags

Filament implementation of feature flags and segmentation with Laravel Pennant.

122177.8k1](/packages/stephenjude-filament-feature-flags)[schmeits/filament-character-counter

This is a Filament character counter TextField and Textarea form field for Filament v4 and v5

34226.4k13](/packages/schmeits-filament-character-counter)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
