Quick Add Select plugin screenshot
Dark mode ready
Multilingual support
Supports v5.x

Quick Add Select

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

Tags: Forms Form Field
Supported versions:
5.x 4.x
Cocosmos avatar Author: Cocosmos

Documentation

Latest Version on Packagist Total Downloads

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

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

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

#Installation

You can install the package via composer:

composer require cocosmos/filament-quick-add-select

#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

Works seamlessly with multiple selects:

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

#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}")

#Disable Quick Add

You can conditionally disable the feature:

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

#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'"

#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

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

<?php

return [
    'add' => '+ Your translation ":term"',
];

#Screenshots

#With Quick Add

With Quick Add New workflow: Search, click "Add", done!

#Multiple Selection

Multiple Selection Works perfectly with multiple selects

#How It Works

The plugin extends Filament's Select component using Laravel's macro system. When you add ->quickAdd():

  1. It overrides the search results to include a special "Add" option when no exact match is found
  2. When the "Add" option is selected, it creates the record immediately
  3. The newly created record's ID replaces the temporary selection
  4. The component displays the proper label from the database

All of this happens client-side with Livewire, so there's no page refresh.

#Requirements

  • PHP 8.1+
  • Laravel 11.0+
  • Filament 4.0+

#Compatibility

  • ✅ Works with single and multiple selects
  • ✅ Compatible with all Filament themes
  • ✅ Supports dark mode
  • ✅ Multi-language support
  • ✅ Works in panels, resources, forms, and custom pages

#Limitations

  • Only works with relationship selects (not options-based selects)
  • Creates records with only the title attribute populated (usually 'name')
  • For complex models requiring additional fields, use the traditional createOptionForm() approach

#Testing

composer test

#Changelog

Please see CHANGELOG for more information on what has changed recently.

#Contributing

Please see CONTRIBUTING for details.

#Credits

#License

The MIT License (MIT). Please see License File for more information.

The author

Cocosmos avatar Author: Cocosmos

I'm a passionate full-stack developer from Switzerland with extensive experience in building modern web and mobile applications. I specialize in Laravel and Filament, creating tools that enhance developer productivity and improve user experiences. My work spans across React, Vue.js, Next.js, and TypeScript on the frontend, while leveraging Laravel's ecosystem on the backend. I'm an active contributor to the open-source community, focusing on creating practical solutions that solve real-world problems. When I'm not coding, I enjoy exploring new technologies and sharing knowledge with fellow developers.

Plugins
1
Stars
16