PHPackages                             royduin/laravel-nova-field-dynamic-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. royduin/laravel-nova-field-dynamic-select

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

royduin/laravel-nova-field-dynamic-select
=========================================

A Laravel Nova field.

1.10.0(4y ago)14284.4k↑14%27[5 issues](https://github.com/royduin/laravel-nova-field-dynamic-select/issues)MITPHPPHP &gt;=7.1.0

Since Jan 30Pushed 1y ago1 watchersCompare

[ Source](https://github.com/royduin/laravel-nova-field-dynamic-select)[ Packagist](https://packagist.org/packages/royduin/laravel-nova-field-dynamic-select)[ RSS](/packages/royduin-laravel-nova-field-dynamic-select/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)DependenciesVersions (29)Used By (0)

Note

This is added within Laravel Nova now:

Dynamic select field for Laravel Nova
=====================================

[](#dynamic-select-field-for-laravel-nova)

This field allows you to dynamically fill contents of a select based on values in other dynamic select fields.

Field is based on [nova-belongs-to-dependency](https://github.com/manmohanjit/nova-belongs-to-dependency) but instead of selecting model, you can select custom values.

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

[](#installation)

```
composer require royduin/laravel-nova-field-dynamic-select

```

Usage
-----

[](#usage)

Class has 5 special methods on top of default Select from Laravel Nova.

- `dependsOn` can take a list of other fields this one depends on. On initial page load the list will be null, so make sure to check for null before accessing.
- `default` can take a list of other fields this one depends on.
- `options` can be either an array or a callable.
- `forAction` to indicate that the dynamic select is running in an action.
- `colors` (optional) to choose which colors to use when highlighting options. Accepts an array with 4 different hexadecimal colors:
    - `highlightBgColor`: Color of the background when the cursor is over an option
    - `highlightTextColor`: Color of the text when the cursor is over an option
    - `selectedHighlightBgColor`: Color of the background when the cursor is over a selected option
    - `selectedHighlightTextColor`: Color of the text when the cursor is over a selected option

If its a callable, it will receive array with selected dependency values as first argument and should return an array of items to be shown on the select field.

Example
-------

[](#example)

```
public function fields(Request $request)
{
    return [
        ID::make()->sortable(),

        DynamicSelect::make('Country', 'country')
            ->options(['US' => 'United States', 'UK' => 'United Kingdom'])
            ->rules('required')
            ->colors([
                'highlightBgColor' => '#0f0',
                'highlightTextColor' => '#fff',
                'selectedHighlightBgColor' => '#f00',
                'selectedHighlightTextColor' => '#fff',
            ])
        ,

        DynamicSelect::make('Provider', 'provider')
            ->options(['PR' => 'Premium', 'ST' => 'Standard'])
            ->rules('required')
        ,

        DynamicSelect::make('Product', 'product')
            ->dependsOn(['country', 'provider'])
            ->options(function($values) {
                if($values['country'] === 'UK' && $values['provider'] === 'PR') {
                    return ['A' => 'Fast shipping', 'B' => 'Normal shipping', 'C' => 'Free shipping'];
                } else {
                    return ['A' => 'Fast shipping', 'B' => 'Normal shipping'];
                }
            })
            ->default(function ($values) {
                if (! $values) {
                    return null;
                }
                if ($values['country'] === 'UK') {
                    return [
                        'label' => 'Normal shipping',
                        'value' => 'B'
                    ];
                }
            })
            ->rules('required')
        ,
    ];
}

```

Example for use in Nova Actions
-------------------------------

[](#example-for-use-in-nova-actions)

```
public function fields(Request $request)
{
    return [
        ID::make()->sortable(),

        DynamicSelect::make('Country', 'country')
            ->forAction(self::class)
            ->options(['US' => 'United States', 'UK' => 'United Kingdom'])
            ->rules('required')
        ,

        DynamicSelect::make('Provider', 'provider')
            ->forAction(self::class)
            ->options(['PR' => 'Premium', 'ST' => 'Standard'])
            ->rules('required')
        ,

        DynamicSelect::make('Product', 'product')
            ->forAction(self::class)
            ->dependsOn(['country', 'provider'])
            ->options(function($values) {
                if($values['country'] === 'UK' && $values['provider'] === 'PR') {
                    return ['A' => 'Fast shipping', 'B' => 'Normal shipping', 'C' => 'Free shipping'];
                } else {
                    return ['A' => 'Fast shipping', 'B' => 'Normal shipping'];
                }
            })
            ->rules('required')
        ,
    ];
}

```

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity45

Moderate usage in the ecosystem

Community22

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~76 days

Total

24

Last Release

1485d ago

Major Versions

0.2.0 → 1.0.02020-04-02

### Community

Maintainers

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

---

Top Contributors

[![royduin](https://avatars.githubusercontent.com/u/1703233?v=4)](https://github.com/royduin "royduin (34 commits)")[![hubertnnn](https://avatars.githubusercontent.com/u/1189576?v=4)](https://github.com/hubertnnn "hubertnnn (14 commits)")[![subzero10](https://avatars.githubusercontent.com/u/5813382?v=4)](https://github.com/subzero10 "subzero10 (8 commits)")[![kayacekovic](https://avatars.githubusercontent.com/u/32109756?v=4)](https://github.com/kayacekovic "kayacekovic (5 commits)")[![RobertoNegro](https://avatars.githubusercontent.com/u/28984898?v=4)](https://github.com/RobertoNegro "RobertoNegro (4 commits)")[![jesperbjoernandersen](https://avatars.githubusercontent.com/u/61787754?v=4)](https://github.com/jesperbjoernandersen "jesperbjoernandersen (2 commits)")[![JBAHapp](https://avatars.githubusercontent.com/u/56063051?v=4)](https://github.com/JBAHapp "JBAHapp (2 commits)")[![Naoray](https://avatars.githubusercontent.com/u/10154100?v=4)](https://github.com/Naoray "Naoray (2 commits)")[![fredrikmikkelsen](https://avatars.githubusercontent.com/u/70882158?v=4)](https://github.com/fredrikmikkelsen "fredrikmikkelsen (2 commits)")[![zbignevg](https://avatars.githubusercontent.com/u/63103420?v=4)](https://github.com/zbignevg "zbignevg (1 commits)")[![crynobone](https://avatars.githubusercontent.com/u/172966?v=4)](https://github.com/crynobone "crynobone (1 commits)")[![ttungbmt](https://avatars.githubusercontent.com/u/12232155?v=4)](https://github.com/ttungbmt "ttungbmt (1 commits)")[![BnitoBzh](https://avatars.githubusercontent.com/u/2962152?v=4)](https://github.com/BnitoBzh "BnitoBzh (1 commits)")

---

Tags

laravelnova

### Embed Badge

![Health badge](/badges/royduin-laravel-nova-field-dynamic-select/health.svg)

```
[![Health](https://phpackages.com/badges/royduin-laravel-nova-field-dynamic-select/health.svg)](https://phpackages.com/packages/royduin-laravel-nova-field-dynamic-select)
```

###  Alternatives

[optimistdigital/nova-multiselect-field

A multiple select field for Laravel Nova.

3403.5M7](/packages/optimistdigital-nova-multiselect-field)[digital-creative/conditional-container

Provides an easy way to conditionally show and hide fields in your Nova resources.

116593.8k4](/packages/digital-creative-conditional-container)[genealabs/laravel-overridable-model

Provide a uniform method of allowing models to be overridden in Laravel.

92398.0k2](/packages/genealabs-laravel-overridable-model)[inspheric/nova-defaultable

Default values for Nova fields when creating resources and running resource actions.

51174.8k1](/packages/inspheric-nova-defaultable)[murdercode/nova4-tinymce-editor

Boost your Laravel Nova with the TinyMCE editor.

17165.2k](/packages/murdercode-nova4-tinymce-editor)[yieldstudio/nova-google-autocomplete

A Laravel Nova Google autocomplete field.

12218.4k](/packages/yieldstudio-nova-google-autocomplete)

PHPackages © 2026

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