PHPackages                             cocosmos/filament-quick-add-select - 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. cocosmos/filament-quick-add-select

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

cocosmos/filament-quick-add-select
==================================

Instantly create and select new options in Filament relationship selects without opening modals

v1.3.0(2mo ago)168.0k↑586.3%5MITPHPPHP ^8.2CI passing

Since Jan 23Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/cocosmos/filament-quick-add-select)[ Packagist](https://packagist.org/packages/cocosmos/filament-quick-add-select)[ Docs](https://github.com/cocosmos/filament-quick-add-select)[ RSS](/packages/cocosmos-filament-quick-add-select/feed)WikiDiscussions main Synced today

READMEChangelog (6)Dependencies (38)Versions (14)Used By (0)

Filament Quick Add Select
=========================

[](#filament-quick-add-select)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c25285fbfafe21c3a0fb6d1d31b35daeb7ded23a4b38a3f3d70ad8b9a22e28a0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f636f736d6f732f66696c616d656e742d717569636b2d6164642d73656c6563742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/cocosmos/filament-quick-add-select)[![Total Downloads](https://camo.githubusercontent.com/e7a79fe15d9f45a1c0352c4512d2bffbe37427f683ebe52def239b3a712ec3ce/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f636f736d6f732f66696c616d656e742d717569636b2d6164642d73656c6563742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/cocosmos/filament-quick-add-select)

Speed up data entry in Filament by enabling users to create and select new relationship options directly from the search dropdown - no modals, no interruptions.

The Problem
-----------

[](#the-problem)

When using Filament's Select component with relationships, users must:

1. Search for an option
2. Realize it doesn't exist
3. Click "Create new option"
4. Fill in a modal form
5. Submit the modal
6. Find and select the newly created option

This workflow interrupts the user's flow and slows down data entry.

The Solution
------------

[](#the-solution)

Quick Add Select adds a "+ Add 'search term'" option directly in the search results. When clicked, it:

- Instantly creates the new record using the search term
- Automatically selects it
- Continues the workflow without interruption

[![Quick Add Select Demo](screenshots/demo.gif)](screenshots/demo.gif)

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

[](#installation)

You can install the package via composer:

```
composer require cocosmos/filament-quick-add-select
```

Usage
-----

[](#usage)

Simply add `->quickAdd()` to any Select component with a relationship:

```
use Filament\Forms\Components\Select;

Select::make('profession_id')
    ->relationship('profession', 'name')
    ->searchable()
    ->quickAdd()
```

That's it! Now when users search for a term that doesn't exist, they'll see an "+ Add 'term'" option.

### Multiple Select

[](#multiple-select)

Works seamlessly with multiple selects:

```
Select::make('skills')
    ->multiple()
    ->relationship('skills', 'name')
    ->searchable()
    ->quickAdd()
```

### Custom Label

[](#custom-label)

Customize the "Add" button label:

```
Select::make('category_id')
    ->relationship('category', 'name')
    ->searchable()
    ->quickAdd(label: fn(string $search) => "Create new: {$search}")
```

Or use a simple string template:

```
->quickAdd(label: "New category: {search}")
```

### Reset Search After Creation

[](#reset-search-after-creation)

By default, after creating a new record, only the "Add" option is removed from the dropdown while keeping the current search text and results intact. This lets users continue working in the same context.

If you prefer to fully clear the search input and results after creation:

```
->quickAdd(resetSearch: true)
```

### Disable Quick Add

[](#disable-quick-add)

You can conditionally disable the feature:

```
->quickAdd(enabled: auth()->user()->can('create', Category::class))
```

Translations
------------

[](#translations)

The plugin includes translations for the default "Add" label in multiple languages:

- 🇬🇧 English: "+ Add ':term'"
- 🇫🇷 French: "+ Ajouter « :term »"
- 🇩🇪 German: "+ Hinzufügen ':term'"
- 🇪🇸 Spanish: "+ Añadir ':term'"
- 🇮🇩 Indonesia: "+ Tambah ':term'"
- 🇮🇹 Italian: "+ Aggiungi ':term'"
- 🇵🇹 Portuguese: "+ Adicionar ':term'"
- 🇸🇦 Arabic: "+ أضف ':term'"

### Publishing Translations

[](#publishing-translations)

To customize translations, publish the language files:

```
php artisan vendor:publish --tag=quick-add-translations
```

Then edit the files in `lang/vendor/quick-add/`.

### Adding New Languages

[](#adding-new-languages)

Create a new translation file in `lang/vendor/quick-add/{locale}/quick-add.php`:

```
