PHPackages                             xoshbin/filament-create-on-search-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. xoshbin/filament-create-on-search-select

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

xoshbin/filament-create-on-search-select
========================================

This is my package filament-create-on-search-select

v0.0.1-alpha(8mo ago)10[4 PRs](https://github.com/Xoshbin/filament-create-on-search-select/pulls)MITPHPPHP ^8.1CI passing

Since Aug 30Pushed 1mo agoCompare

[ Source](https://github.com/Xoshbin/filament-create-on-search-select)[ Packagist](https://packagist.org/packages/xoshbin/filament-create-on-search-select)[ Docs](https://github.com/xoshbin/filament-create-on-search-select)[ GitHub Sponsors](https://github.com/Xoshbin)[ RSS](/packages/xoshbin-filament-create-on-search-select/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (13)Versions (6)Used By (0)

Filament Create On Search Select
================================

[](#filament-create-on-search-select)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d18771139283bc7c53469a541eaea06f102d6c346eabb517c2b4ee74caf43b78/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f786f736862696e2f66696c616d656e742d6372656174652d6f6e2d7365617263682d73656c6563742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/xoshbin/filament-create-on-search-select)[![GitHub Tests Action Status](https://camo.githubusercontent.com/eae5f78ef800e39c06cdb947fcdc77b282deda8242e72ec6a9e397c7aa337fbd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f786f736862696e2f66696c616d656e742d6372656174652d6f6e2d7365617263682d73656c6563742f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/xoshbin/filament-create-on-search-select/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/a9c355ed23305ac3146de272e14779971860c0fafc1fc8d50f3dd5ccd31c487a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f786f736862696e2f66696c616d656e742d6372656174652d6f6e2d7365617263682d73656c6563742f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/xoshbin/filament-create-on-search-select/actions?query=workflow%3A%22Fix+PHP+code+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/4e8e06363087302e2af89e0913571b8d494d874bef6cbd8c565c054ca8113af6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f786f736862696e2f66696c616d656e742d6372656174652d6f6e2d7365617263682d73656c6563742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/xoshbin/filament-create-on-search-select)

[![Filament Create On Search Select Preview](./.github/resources/preview.png)](./.github/resources/preview.png)

A space-efficient Filament form field that solves the interface clutter problem of the original Select field's creation functionality. While Filament's native Select field adds a suffix button and icon for creating new records (which takes up valuable interface space), this component provides a cleaner, more intuitive solution.

The Problem This Solves
-----------------------

[](#the-problem-this-solves)

Filament's default Select field with `createOptionForm()` adds visual clutter:

- ➕ Suffix button takes up horizontal space
- 🎯 Icon makes the field wider and less clean

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

[](#the-solution)

This component provides the same searchable Select functionality as the original, but with a smarter approach to record creation:

✅ **Clean Interface**: No suffix buttons or icons cluttering your forms ✅ **Smart Suggestions**: When searching for a record that doesn't exist, shows "Create \[search term\]" suggestion ✅ **Seamless UX**: Click the suggestion to open the same modal creation experience ✅ **Space Efficient**: Maintains the original Select field's compact design ✅ **Fully Customizable**: All the same customization options as the original field

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

[](#installation)

You can install the package via composer:

```
composer require xoshbin/filament-create-on-search-select
```

How It Works
------------

[](#how-it-works)

1. **Search Experience**: Users type to search through existing records (same as original Select)
2. **Smart Detection**: When no matching records are found, shows "Create \[search term\]" suggestion
3. **Modal Creation**: Clicking the suggestion opens the familiar Filament modal for creating new records
4. **Seamless Integration**: New record is automatically selected and form continues normally

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

Replace your existing Select field with `CreateOnSearchSelect`:

```
use Xoshbin\FilamentCreateOnSearchSelect\CreateOnSearchSelect;
use Filament\Forms\Components\TextInput;

// Instead of this cluttered approach:
// Select::make('category_id')
//     ->options(Category::pluck('name', 'id'))
//     ->searchable()
//     ->createOptionForm([...]) // Adds suffix button + icon

// Use this clean approach:
CreateOnSearchSelect::make('category_id')
    ->label('Category')
    ->options(Category::pluck('name', 'id'))
    ->canCreateOption()
    ->createOptionForm([
        TextInput::make('name')
            ->label('Category Name')
            ->required()
            ->maxLength(255),
    ])
    ->createOptionAction(function (array $data) {
        return Category::create([
            'name' => $data['name'],
            'company_id' => auth()->user()->company_id,
        ]);
    })
```

### Advanced Usage

[](#advanced-usage)

#### Custom Create Form

[](#custom-create-form)

You can customize the form fields shown in the create modal using Filament form components:

```
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Textarea;

CreateOnSearchSelect::make('customer_id')
    ->label('Customer')
    ->options(Partner::where('type', 'customer')->pluck('name', 'id'))
    ->canCreateOption()
    ->createOptionForm([
        TextInput::make('name')
            ->label('Customer Name')
            ->required()
            ->maxLength(255),
        TextInput::make('email')
            ->label('Email Address')
            ->email()
            ->maxLength(255),
        TextInput::make('phone')
            ->label('Phone Number')
            ->tel()
            ->maxLength(20),
        Textarea::make('address')
            ->label('Address')
            ->rows(3),
    ])
    ->createOptionAction(function (array $data) {
        return Partner::create([
            'name' => $data['name'],
            'email' => $data['email'] ?? null,
            'phone' => $data['phone'] ?? null,
            'address' => $data['address'] ?? null,
            'type' => 'customer',
            'company_id' => auth()->user()->company_id,
        ]);
    })
```

#### Custom Modal Labels

[](#custom-modal-labels)

Customize the modal heading and button labels:

```
CreateOnSearchSelect::make('category_id')
    ->label('Category')
    ->options(Category::pluck('name', 'id'))
    ->canCreateOption()
    ->createOptionModalHeading('Create New Category')
    ->createOptionModalSubmitActionLabel('Create Category')
    ->createOptionModalCancelActionLabel('Cancel')
    ->createOptionAction(function (array $data) {
        return Category::create([
            'name' => $data['name'],
        ]);
    })
```

### Available Methods

[](#available-methods)

MethodDescription`canCreateOption(bool $condition = true)`Enable/disable the create option functionality`createOptionAction(Closure $action)`Define the action to create a new option`createOptionForm(string $form)`Custom HTML form for the create modal`createOptionModalHeading(string $heading)`Set the modal heading text`createOptionModalSubmitActionLabel(string $label)`Set the submit button text`createOptionModalCancelActionLabel(string $label)`Set the cancel button text### Key Features

[](#key-features)

**Interface Benefits:**

- ✅ **No visual clutter** - No suffix buttons or icons taking up space
- ✅ **Clean design** - Maintains the original Select field appearance
- ✅ **Intuitive UX** - "Create \[search term\]" suggestions feel natural

**Technical Features:**

- ✅ Extends Filament's native Select component
- ✅ Modal-based option creation (same as original)
- ✅ Fully searchable with real-time filtering
- ✅ Customizable form fields and validation
- ✅ Dark mode support
- ✅ Accessible keyboard navigation (Arrow keys, Enter, Escape)
- ✅ Works with relationships and custom models
- ✅ Supports all original Select field options

Testing
-------

[](#testing)

```
composer test
```

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)

- [Khoshbin](https://github.com/Xoshbin)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance78

Regular maintenance activity

Popularity2

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 93.5% 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

Unknown

Total

1

Last Release

255d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/88844b024c613b0dff2f4355a3ce9938287ec682d1f27964fbee51857b3bd4ff?d=identicon)[khoshbin](/maintainers/khoshbin)

---

Top Contributors

[![Xoshbin](https://avatars.githubusercontent.com/u/1606070?v=4)](https://github.com/Xoshbin "Xoshbin (29 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

laravelXoshbinfilament-create-on-search-select

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/xoshbin-filament-create-on-search-select/health.svg)

```
[![Health](https://phpackages.com/badges/xoshbin-filament-create-on-search-select/health.svg)](https://phpackages.com/packages/xoshbin-filament-create-on-search-select)
```

###  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.

320392.1k17](/packages/codewithdennis-filament-select-tree)[ralphjsmit/laravel-filament-components

A collection of reusable components for Filament.

10972.2k2](/packages/ralphjsmit-laravel-filament-components)[schmeits/filament-character-counter

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

33184.7k6](/packages/schmeits-filament-character-counter)[defstudio/filament-searchable-input

A searchable autocomplete input for Filament forms

3212.4k](/packages/defstudio-filament-searchable-input)[codebar-ag/laravel-filament-json-field

A Laravel Filament JSON Field integration with CodeMirror support

1124.1k](/packages/codebar-ag-laravel-filament-json-field)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)

PHPackages © 2026

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