PHPackages                             madzee-m/moonshine-tom-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. madzee-m/moonshine-tom-select

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

madzee-m/moonshine-tom-select
=============================

Tom select for MoonShine

1.0.4(10mo ago)4855MITTypeScriptPHP ^8.2|^8.3|^8.4

Since Jul 6Pushed 10mo agoCompare

[ Source](https://github.com/MadZee-M/moonshine-tom-select)[ Packagist](https://packagist.org/packages/madzee-m/moonshine-tom-select)[ Docs](https://moonshine-laravel.com)[ RSS](/packages/madzee-m-moonshine-tom-select/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (4)Versions (4)Used By (0)

[Tom select](https://tom-select.js.org) field for [MoonShine Laravel admin panel](https://moonshine-laravel.com)
================================================================================================================

[](#tom-select-field-for-moonshine-laravel-admin-panel)

---

Compatibility
-------------

[](#compatibility)

MoonShineMoonshine Tom selectCurrently supported&gt;= v3.0&gt;= v1.0.0yesInstallation
------------

[](#installation)

```
composer require MadZee-M/moonshine-tom-select
```

Usage
-----

[](#usage)

```
use MadZeeM\MoonshineTomSelect\Fields\TomSelect;

TomSelect::make('Select')
```

> Данное поле полностью совместима с текущим основным полем MoonShine, поэтому можно сделать так, для быстрой интеграции:
>
> ```
> - use MoonShine\UI\Fields\Select;
> + use MadZeeM\MoonshineTomSelect\Fields\TomSelect as Select;
> ```

Также вместо `BelongsTo` и `BelongsToMany` можно воспользоваться

```
use MadZeeM\MoonshineTomSelect\Fields\TomSelectBelongsTo;
use MadZeeM\MoonshineTomSelect\Fields\TomSelectBelongsToMany;

TomSelectBelongs::make('Select')
TomSelectBelongsToMany::make('Select')
```

> И точно также для быстрой интеграции, можно сделать:
>
> ```
> - use MoonShine\Laravel\Fields\Relationships\BelongsTo;
> + use MadZeeM\MoonshineTomSelect\Fields\TomSelectBelongsTo as BelongsTo;
>
> - use MoonShine\Laravel\Fields\Relationships\BelongsToMany;
> + use MadZeeM\MoonshineTomSelect\Fields\TomSelectBelongsToMany as BelongsToMany;
> ```

Plugins
-------

[](#plugins)

The `addPlugins()` method allows you to add new plugins to the default plugins

> Official plugins:

```
addPlugins(array|string $plugin, array $pluginOptions = [])
```

```
TomSelect::make('Select')
    ->addPlugins('checkbox_options', [...])

TomSelect::make('Select')
    ->addPlugins(['checkbox_options', '...'])

TomSelect::make('Select')
    ->addPlugins([
        'checkbox_options' => [...]
    ])
```

Вы можете создавать собственные плагины.

```

    document.addEventListener('moonshine:select.add_plugin', function({ detail: createPlugin }) {
        createPlugin('myPlugin', function(pluginOptions) {
            console.log(pluginOptions, this.getValue())

            this.on('change', value => {
                //
            })
        })
    })

```

```
TomSelect::make('Select')
    ->addPlugins('myPlugin', [
        'foo' => 'bar'
    ])
```

> Full documentation:

Settings
--------

[](#settings)

Этот `settings()` метод разрешает использовать все пользовательские настройки

> Все доступные настройки:

```
settings(array $settings)
```

```
TomSelect::make('Select')
    ->settings([
        'maxOptions' => 100,
        'maxItems' => 100,
        'hideSelected' => false
    ])
```

---

Для всех именных настроек, есть очень удобный метод `fieldNames()`

```
fieldNames(
    ?string $valueField = null,         // default: value
    ?string $labelField = null,         // default: label
    ?string $descriptionField = null,   // default: description

    ?string $childrenField = null,      // default: values
    ?string $optgroupValueField = null, // default: value
    ?string $optgroupLabelField = null, // default: label
    ?string $optgroupField = null,      // default: optgroup

    ?array $searchField = null,         // default: ['label']
    ?string $disabledField = null,      // default: disabled
    ?string $sortField = null           // default: $order
)
```

```
TomSelect::make('Select')
    ->fieldNames(
        valueField: 'id',
        labelField: 'name',
        childrenField: 'children',
    )
```

---

Для дополнительной настройки асинхронности, можно воспользоваться методом `asyncSettings()`

```
asyncSettings(array $settings)
```

```
TomSelect::make('Select')
    ->asyncSettings([
        // Можно менять название поля поиска
        'queryKey' => 'query',

        // Можно отправить текущие активные значения, просто указываем название
        'selectedValuesKey' => '_value',

        // Если результат обвернуть например в data, то указываем этот ключ
        'resultKey' => 'data',

        // Если хотите, чтобы вместе с запросом, шли все поля текущей формы, то задаем TRUE
        'withAllFields' => false,
    ])
```

---

Этот `asyncOnInit()` метод теперь поддерживает "Загрузчик", после открытия селекта

```
asyncOnInit(bool $whenOpen = true, bool $withLoading = false)
```

```
TomSelect::make('Select')
    ->asyncOnInit(withLoading: true)
```

---

> С этим `multiple()` методом автоматически задается поиск, если хотите отключить, просто указываем `withoutSearchable()` после метода
>
> ```
> TomSelect::make('Select')
>   ->multiple()
>   ->withoutSearchable()
> ```

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance54

Moderate activity, may be stable

Popularity22

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~2 days

Total

3

Last Release

306d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/350dc8fc744eb27fff5081c7cfff3f98493871a8d3427ceceb551be58a71bf26?d=identicon)[MadZee-M](/maintainers/MadZee-M)

---

Top Contributors

[![MadZee-M](https://avatars.githubusercontent.com/u/32099597?v=4)](https://github.com/MadZee-M "MadZee-M (9 commits)")

---

Tags

moonshinetomSelect

###  Code Quality

TestsPHPUnit

Static AnalysisRector

### Embed Badge

![Health badge](/badges/madzee-m-moonshine-tom-select/health.svg)

```
[![Health](https://phpackages.com/badges/madzee-m-moonshine-tom-select/health.svg)](https://phpackages.com/packages/madzee-m-moonshine-tom-select)
```

###  Alternatives

[dev-lnk/moonshine-builder

Project builder for MoonShine

254.8k](/packages/dev-lnk-moonshine-builder)

PHPackages © 2026

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