PHPackages                             marshmallow/nova-multiselect-field - 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. marshmallow/nova-multiselect-field

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

marshmallow/nova-multiselect-field
==================================

A multiple select field for Laravel Nova.

v5.1.1(4mo ago)08.9k↓26.7%2MITPHPPHP &gt;=8.0CI failing

Since Jan 7Pushed 4mo ago2 watchersCompare

[ Source](https://github.com/marshmallow-packages/nova-multiselect-field)[ Packagist](https://packagist.org/packages/marshmallow/nova-multiselect-field)[ RSS](/packages/marshmallow-nova-multiselect-field/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (5)Versions (10)Used By (2)

Nova Multiselect
================

[](#nova-multiselect)

[![Latest Version on Packagist](https://camo.githubusercontent.com/0a5e76c7f4903d60ac2029c192f55d1907e2b28c712ab0aefdc9e13570abc7f9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d617273686d616c6c6f772f6e6f76612d6d756c746973656c6563742d6669656c642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/marshmallow/nova-multiselect-field)[![Total Downloads](https://camo.githubusercontent.com/2da38c9e2176e272b5c2b4bfff7e45d96e9844b529789a2460528c4132305c20/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d617273686d616c6c6f772f6e6f76612d6d756c746973656c6563742d6669656c642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/marshmallow/nova-multiselect-field)

This [Laravel Nova](https://nova.laravel.com) package adds a multiselect to Nova's arsenal of fields.

Important

This package was originally forked from [outl1ne/nova-multiselect-field](https://github.com/outl1ne/nova-multiselect-field). Since we were making many opinionated changes, we decided to continue development in our own version rather than submitting pull requests that might not benefit all users of the original package. You’re welcome to use this package, we’re actively maintaining it. If you encounter any issues, please don’t hesitate to reach out.

Requirements
------------

[](#requirements)

- `php: >=8.1`
- `laravel/nova: ^5.0`

Features
--------

[](#features)

- Multi- and singleselect with search
- Asynchronous search
- Reordering functionality with drag &amp; drop
- Dependency on other Multiselect instances
- Distinct values between multiple multiselects
- Fully compatible with light and dark modes

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

[](#installation)

Install the package in a Laravel Nova project via Composer:

```
composer require marshmallow/nova-multiselect-field
```

Usage
-----

[](#usage)

The field is used similarly to Nova's native Select field. The field type in the database should be text-based (ie `string`, `text` or `varchar`), selected values are stored as a stringified JSON array.

```
use Marshmallow\MultiselectField\Multiselect;

public function fields(Request $request)
{
    return [
      Multiselect::make('Football teams')
        ->options([
          'liverpool' => 'Liverpool FC',
          'tottenham' => 'Tottenham Hotspur',
        ])

        // Optional:
        ->placeholder('Choose football teams') // Placeholder text
        ->max(4) // Maximum number of items the user can choose
        ->saveAsJSON() // Saves value as JSON if the database column is of JSON type
        ->optionsLimit(5) // How many items to display at once
        ->reorderable() // Allows reordering functionality
        ->singleSelect() // If you want a searchable single select field
        ->distinct('football') // Disables values used by other multiselects in same distinct group
        ->taggable() // Possible to add values ("tags") on the fly

        // Async model querying
        Multiselect::make('Artists')
          ->asyncResource(Artist::class),

          // If you want a custom search, create your own endpoint:
          ->api('/api/multiselect/artists?something=false', Artist::class),
    ];
}
```

### Option groups

[](#option-groups)

Option groups are supported. Their syntax is the same as [Laravel's option group syntax](https://nova.laravel.com/docs/2.0/resources/fields.html#select-field).

In this example (from Nova docs), all values are grouped by the `group` key:

```
->options([
    'MS' => ['label' => 'Small', 'group' => 'Men Sizes'],
    'MM' => ['label' => 'Medium', 'group' => 'Men Sizes'],
    'WS' => ['label' => 'Small', 'group' => 'Women Sizes'],
    'WM' => ['label' => 'Medium', 'group' => 'Women Sizes'],
])
```

### Dependencies

[](#dependencies)

You can make a Multiselect depend on another by using `optionsDependOn`. The value from the `optionsDependOn` Multiselect has to be the key to the options and the value must be a key-value dictionary of options as usual.

Usage:

```
Multiselect::make('Country', 'country')
    ->options([
        'IT' => 'Italy',
        'SG' => 'Singapore',
    ]),

Multiselect::make('Language', 'language')
    ->optionsDependOn('country', [
        'IT' => [
            'it' => 'Italian',
        ],
        'SG' => [
            'en' => 'English',
            'ms' => 'Malay',
            'zh' => 'Chinese',
        ]
    ]),

    // Optionally define max number of values
    ->optionsDependOnMax([
        'IT' => 1,
        'SG' => 3,
    ])
```

Belongs-To-Many
---------------

[](#belongs-to-many)

You can use this field for `BelongsToMany` relationship selection.

```
// Add your BelongsToMany relationship to your model:
public function categories()
{
    return $this->belongsToMany(\App\Models\Category::class);
}

// Add the field to your Resource for asynchronous option querying:
Multiselect::make('Categories', 'categories')
  ->belongsToMany(\App\Nova\Resources\Category::class),

// Alternatively, you can set the second argument to 'false' to
// query the options on page load and prevent the user from having
// to first type in order to view the available options. Note: Not
// recommended for unbounded relationship row counts.
Multiselect::make('Categories', 'categories')
  ->belongsToMany(\App\Nova\Resources\Category::class, false),
```

Options
-------

[](#options)

Possible options you can pass to the field using the option name as a function, ie `->placeholder('Choose peanuts')`.

Optiontypedefaultdescription`options`Array|callable\[\]Options in an array as key-value pairs (`['id' => 'value']`).`api($path, $resource)`String, String (Resource)nullURL that can be used to fetch options asynchronously. The search string is provided in the `search` query parameter. The API must return object containing key-value pairs (`['id' => 'value']`).`asyncResource($resource)`String (Resource)nullProvide a Resource class to fetch the options asynchronously.`placeholder`StringField nameThe placeholder string for the input.`max`NumberInfiniteThe maximum number of options a user can select.`groupSelect`BooleanfalseFor use with option groups - allows the user to select whole groups at once`singleSelect`BooleanfalseMakes the field act as a single select which also means the saved value will not be an array.`saveAsJSON`BooleanfalseWhen you have a SQL JSON column, you can force the field to save the values as JSON. By default, values are saved as a stringified array.`optionsLimit`Number1000The maximum number of options displayed at once. Other options are still accessible through searching.`nullable`BooleanfalseIf the field is nullable an empty select will result in `null` else an empty array (`[]`) is stored.`reorderable`BooleanfalseEnables (or disables) the reordering functionality of the multiselect field.`optionsDependOn`String, ArraynullDetermines which Multiselect this field depends on.`belongsToMany`String (Resource)nullAllows the Multiselect to function as a BelongsToMany field.`belongsTo`String (Resource)nullAllows the Multiselect to function as a BelongsTo field.`taggable`BooleanfalseMakes the Multiselet to support tags (dynamically entered values).`clearOnSelect`BooleanfalseClears input after an option has been selected.`distinct`StringField AttributeSyncs options between multiple multiselects in the same group and disables the options that have already been used.`indexDelimiter`String`', '`Sets delimiter used to join values on index view`indexValueDisplayLimit`Number9999Define how many values can be displayed at once on index view`indexCharDisplayLimit`Number40Set char limit for index display valueLocalization
------------

[](#localization)

The translations file can be published by using the following publish command:

```
php artisan vendor:publish --provider="Marshmallow\MultiselectField\FieldServiceProvider" --tag="translations"
```

You can then edit the strings to your liking.

Overwriting the detail field
----------------------------

[](#overwriting-the-detail-field)

You can overwrite the detail view value component to customize it as you see fit.

Create a new component for `NovaMultiselectDetailFieldValue` and register it in your `app.js`. The component receives two props: `field` and `values`. The `values` prop is an array of selected labels.

```
// in NovaMultiselectDetailFieldValue.vue

        {{ value }}

  —

export default {
  props: ['field', 'values'],
};

```

```
// in app.js

import NovaMultiselectDetailFieldValue from './NovaMultiselectDetailFieldValue';

Nova.booting((Vue, router, store) => {
  Vue.component('nova-multiselect-detail-field-value', NovaMultiselectDetailFieldValue);
});
```

Overwriting the form tag field
------------------------------

[](#overwriting-the-form-tag-field)

You can overwrite the tag template in the form-field component to customize it as you see fit.

Create a new component for `FormFieldTag` and register it in your `app.js`. The component receives two props: `option` and `remove`. The `option` prop is an object with, for example, the `label`.

```
// in FormFieldTag.vue

    {{ option.label.trim() }}

export default {
  props: ['option', 'remove'],
};

```

```
// in app.js

import FormFieldTag from './FormFieldTag';

Nova.booting((Vue, router, store) => {
  Vue.component('form-multiselect-field-tag', FormFieldTag);
});
```

Credits
-------

[](#credits)

- [Tarvo Reinpalu](https://github.com/Tarpsvo)
- [shentao/vue-multiselect](https://vue-multiselect.js.org)
- [outl1ne/nova-multiselect-field](https://github.com/outl1ne/nova-multiselect-field)

License
-------

[](#license)

This project is open-sourced software licensed under the [MIT license](LICENSE.md).

###  Health Score

43

—

FairBetter than 90% of packages

Maintenance79

Regular maintenance activity

Popularity23

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity49

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 ~49 days

Recently: every ~86 days

Total

8

Last Release

142d ago

Major Versions

v4.0.3 → v5.0.12025-01-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/be33d2624e24c516e73892b0929447cc762f3622c024ab8d0d2a59042e5d2c7f?d=identicon)[marshmallow](/maintainers/marshmallow)

---

Top Contributors

[![stefvanesch](https://avatars.githubusercontent.com/u/46725619?v=4)](https://github.com/stefvanesch "stefvanesch (10 commits)")[![LTKort](https://avatars.githubusercontent.com/u/2412670?v=4)](https://github.com/LTKort "LTKort (2 commits)")

---

Tags

laravelselectmultiselectnova

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/marshmallow-nova-multiselect-field/health.svg)

```
[![Health](https://phpackages.com/badges/marshmallow-nova-multiselect-field/health.svg)](https://phpackages.com/packages/marshmallow-nova-multiselect-field)
```

###  Alternatives

[optimistdigital/nova-multiselect-field

A multiple select field for Laravel Nova.

3403.5M7](/packages/optimistdigital-nova-multiselect-field)[optimistdigital/nova-sortable

This Laravel Nova package allows you to reorder models in a Nova resource's index view using drag &amp; drop.

2872.1M6](/packages/optimistdigital-nova-sortable)[outl1ne/nova-sortable

This Laravel Nova package allows you to reorder models in a Nova resource's index view using drag &amp; drop.

2861.8M9](/packages/outl1ne-nova-sortable)[outl1ne/nova-multiselect-field

A multiple select field for Laravel Nova.

3402.9M2](/packages/outl1ne-nova-multiselect-field)[ziffmedia/nova-select-plus

A Nova select field for simple and complex select inputs

96578.4k1](/packages/ziffmedia-nova-select-plus)[outl1ne/nova-multiselect-filter

Multiselect filter for Laravel Nova.

45802.7k3](/packages/outl1ne-nova-multiselect-filter)

PHPackages © 2026

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