PHPackages                             unexpectedjourney/filament-modal-resource-picker - 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. unexpectedjourney/filament-modal-resource-picker

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

unexpectedjourney/filament-modal-resource-picker
================================================

A powerful resource picker for Filament.

v1.0.2(2y ago)5123[2 PRs](https://github.com/rhiannonjourney/filament-resource-picker/pulls)1MITPHPPHP ^8.1

Since Nov 3Pushed 1y ago1 watchersCompare

[ Source](https://github.com/rhiannonjourney/filament-resource-picker)[ Packagist](https://packagist.org/packages/unexpectedjourney/filament-modal-resource-picker)[ Docs](https://github.com/unexpectedjourney/filament-resource-picker)[ GitHub Sponsors](https://github.com/unexpectedjourney)[ RSS](/packages/unexpectedjourney-filament-modal-resource-picker/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (14)Versions (7)Used By (1)

A powerful resource picker for Filament.
========================================

[](#a-powerful-resource-picker-for-filament)

[![Latest Version on Packagist](https://camo.githubusercontent.com/1d59a829eedc910d83981103a4cf6466d1c378dab97213fc38d112930b0aceae/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f756e65787065637465646a6f75726e65792f66696c616d656e742d6d6f64616c2d7265736f757263652d7069636b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/unexpectedjourney/filament-modal-resource-picker)[![GitHub Tests Action Status](https://camo.githubusercontent.com/154d47d48273e86ff3478bcd2b6364d4e103321e4164de3affbf84f627209f9d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f756e65787065637465646a6f75726e65792f66696c616d656e742d7265736f757263652d7069636b65722f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/unexpectedjourney/filament-resource-picker/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/42689319f7e2545ddbf5b22b4c1a891b21df34e78aa28028d9766b7f4f33e136/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f756e65787065637465646a6f75726e65792f66696c616d656e742d7265736f757263652d7069636b65722f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/unexpectedjourney/filament-resource-picker/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/c8b59737426eaebc2f4f4996e103748b0aa4a70814deb449b2455d8f4b9e6898/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f756e65787065637465646a6f75726e65792f66696c616d656e742d6d6f64616c2d7265736f757263652d7069636b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/unexpectedjourney/filament-resource-picker)

[![](documentation/img/resource-picker.png)](documentation/img/resource-picker.png)

Adds a new ResourcePicker form component that lets users browse and select models using your existing resources in modal.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require unexpectedjourney/filament-modal-resource-picker
```

Usage
-----

[](#usage)

Add the plugin to your panel provider

```
use UnexpectedJourney\FilamentResourcePicker\FilamentResourcePickerPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            FilamentResourcePickerPlugin::make(),
        ])
    ])
}
```

Then add the component to your form

```
use UnexpectedJourney\FilamentResourcePicker\Forms\Components\ResourcePicker;

public static function form(Form $form): Form
{
    return $form
        ->schema([
            ResourcePicker::make('component_id')
                ->resource(ProductResource::class),
        ]);
}
```

This adds a button to your form that when clicked opens a modal with the table from the resource specified in the `resource()` method. All columns and filters will be available while all Actions are removed.

Just click a record to select it and click it again to deselect it. When a record is selected it will show up in the right hand sidebar. You may deselect a record in this sidebar by hovering your mouse over it and clicking the trash icon that appears.

Once you've selected the record (or records in the case of a multiple select) click the update and close. The modal will close and you will see the selected records reflected in your form. You may remove a record from the selection by hovering your mouse over it and clicking the trash icon that appears.

### Selecting multiple records (and sorting)

[](#selecting-multiple-records-and-sorting)

To select multiple records use the `multiple()` method.

```
use UnexpectedJourney\FilamentResourcePicker\Forms\Components\ResourcePicker;

public static function form(Form $form): Form
{
    return $form
        ->schema([
            ResourcePicker::make('component_id')
                ->resource(ProductResource::class)
                ->multiple(),
        ]);
}
```

If you would like the selected records to be sortable than call the `sortable()`method.

```
use UnexpectedJourney\FilamentResourcePicker\Forms\Components\ResourcePicker;

public static function form(Form $form): Form
{
    return $form
        ->schema([
            ResourcePicker::make('component_id')
                ->resource(ProductResource::class)
                ->multiple()
                ->sortable(),
        ]);
}
```

### Integrating with an Eloquent relationship

[](#integrating-with-an-eloquent-relationship)

You may employ the `relationship()` method of the `ResourcePicker` to configure a `HasMany`relationship. The `ResourcePicker` will load the item data from the relationship, and save it back to the relationship when the form is submitted. If a custom relationship name is not passed to `relationship()`, the field name will be used as the relationship name:

```
use UnexpectedJourney\FilamentResourcePicker\Forms\Components\ResourcePicker;

public static function form(Form $form): Form
{
    return $form
        ->schema([
            ResourcePicker::make('cross_sell_products')
                ->resource(ProductResource::class)
                ->relationship()
                ->multiple(),
        ]);
}
```

#### Sorting items in a relationship

[](#sorting-items-in-a-relationship)

By default, reordering relationship items is disabled. This is because your related model needs a sort column to store the order of related records. To enable sorting, you may use the orderColumn() method, passing in a name of the column on your related model to store the order in:

```
use UnexpectedJourney\FilamentResourcePicker\Forms\Components\ResourcePicker;

public static function form(Form $form): Form
{
    return $form
        ->schema([
            ResourcePicker::make('cross_sell_products')
                ->resource(ProductResource::class)
                ->relationship()
                ->multiple()
                ->orderColumn('sort')
        ]);
}
```

### Searching selected records

[](#searching-selected-records)

When selecting multiple records you can search the selected records using the text input above the selected records on the right hand side of the `ResourcePicker` modal. By default, this filter will use search the `recordTitleAttribute` configured on the resource. You can configure the columns used in this filter on a resource by resource basis by configuring your resource pickers.

### Configuring your resource pickers

[](#configuring-your-resource-pickers)

Inside the boot method of a service provider call `ResourcePickerManager::configure()` and pass a key value array. The key is the class name of the resource you want to configure and the value is a closure that receives a `ResourcePickerConfiguration` argument named `$configuration`.

```
use UnexpectedJourney\FilamentResourcePicker\Facades\ResourcePickerManager;

public function boot(): void
{
    ResourcePickerManager::configure([
        ProductResource::class => fn(ResourcePickerConfiguration $configuration) => $configuration,
    ]);
}
```

#### Configuring fields used for searching results

[](#configuring-fields-used-for-searching-results)

Use the `searchColumns` method of the `ResourcePickerConfiguration` to pass an array of columns that should be used when searching through the results in the `ResourcePicker` modal.

```
use UnexpectedJourney\FilamentResourcePicker\Facades\ResourcePickerManager;

public function boot(): void
{
    ResourcePickerManager::configure([
        ProductResource::class => fn(ResourcePickerConfiguration $configuration) => $configuration
            ->searchColumns([
                'name',
                'part_number',
                'vendor.name',
            ]),
    ]);
}
```

#### Configuring the selected record previews

[](#configuring-the-selected-record-previews)

The `ResourcePicker` displays the record title configured on your Filament resource by default. Use the `previewComponent()` method on the ResourcePickerConfiguration and pass it the name of a Blade component to be used to display the preview.

```
use UnexpectedJourney\FilamentResourcePicker\Facades\ResourcePickerManager;

public function boot(): void
{
    ResourcePickerManager::configure([
        ProductResource::class => fn(ResourcePickerConfiguration $configuration) => $configuration
            ->previewComponent('products.card.mini')
    ]);
}
```

Your Blade component can access the selected record by adding a `record`property as documented .

### Configuring a custom ResourceBrowser component

[](#configuring-a-custom-resourcebrowser-component)

In some cases you may want to extend the `ResourceBrowser` component to add your own functionality, for instance adding support for the \[Advanced Table\]([https://filamentphp.com/plugins/kenneth-sese-advanced-tables\]](https://filamentphp.com/plugins/kenneth-sese-advanced-tables%5D) plugin) to the table.

First create your custom `ResourceBrowser` component making sure to extend `UnexpectedJourney\FilamentResourcePicker\Livewire\ResourceBrowser`.

```
use UnexpectedJourney\FilamentResourcePicker\Livewire\ResourceBrowser;

class CustomResourceBrowser extends esourceBrowser
{
    // Add any custom functionality
}
```

Then configure the plugin to use your custom `ResourceBrowser` in your plugin Panel provider.

```
use UnexpectedJourney\FilamentResourcePicker\FilamentResourcePickerPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            FilamentResourcePickerPlugin::make()
                ->resourceBrowserComponent(CustomResourceBrowser::class),
        ])
    ])
}
```

### Render Hooks

[](#render-hooks)

Filament Resource Picker exposes some render hooks to allow you to inject custom HTML into the UI. View the [Filament documentation](https://filamentphp.com/docs/3.x/support/render-hooks#registering-render-hooks)for how to register a render hook.

#### Available Render Hooks

[](#available-render-hooks)

```
use \UnexpectedJourney\FilamentResourcePicker\Support\ResourcePickerRenderHook
```

- `ResourcePickerRenderHook::RESOURCE_BROWSER_TABLE_BEFORE` - Before the table of the Resource Browser

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](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Rhiannon Journey](https://github.com/rhiannonjourney)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance27

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% 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 ~75 days

Total

3

Last Release

771d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/49036ffcea54e2351dde75438e4c77a949c37333381a0e508f0595d70ed387c4?d=identicon)[rhiannonjourney](/maintainers/rhiannonjourney)

---

Top Contributors

[![rhiannonjourney](https://avatars.githubusercontent.com/u/148484535?v=4)](https://github.com/rhiannonjourney "rhiannonjourney (30 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (2 commits)")

---

Tags

laravelunexpectedjourneyfilament-modal-resource-picker

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/unexpectedjourney-filament-modal-resource-picker/health.svg)

```
[![Health](https://phpackages.com/badges/unexpectedjourney-filament-modal-resource-picker/health.svg)](https://phpackages.com/packages/unexpectedjourney-filament-modal-resource-picker)
```

###  Alternatives

[guava/calendar

Adds support for vkurko/calendar to Filament PHP.

298241.0k3](/packages/guava-calendar)[pboivin/filament-peek

Full-screen page preview modal for Filament

253319.6k12](/packages/pboivin-filament-peek)[dotswan/filament-map-picker

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

124139.3k2](/packages/dotswan-filament-map-picker)[creagia/filament-code-field

A Filamentphp input field to edit or view code data.

58289.3k3](/packages/creagia-filament-code-field)[swisnl/filament-backgrounds

Beautiful backgrounds for Filament auth pages

54149.2k6](/packages/swisnl-filament-backgrounds)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)

PHPackages © 2026

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