gabrielesbaiz/nova-ajax-select

Ajax select / dependent select field for Laravel Nova.
16,061
Install
composer require gabrielesbaiz/nova-ajax-select
Latest Version:2.0.0
PHP:^8.3
License:MIT
Last Updated:Sep 24, 2026
Links: GitHub  ·  Packagist
Maintainer: gabrielesbaiz

NovaAjax Select

A Laravel Nova select field whose options are resolved on the server — scoped to whatever the user picked a moment ago, searched in the database rather than the browser, and validated on the way back in.

Latest version PHP Laravel Downloads Stars Sponsor

📖 Read the documentation →

Every method, a live chain you can click through, the option-shape normalizer with your own payload pasted in, and the upgrade path from 1.x.

[!CAUTION] Upgrading from 1.x? Nothing is required — get(), parent() and the NovaAjaxSelect class all still work. But 1.x shared its asset handle with alexwenzel/ajax-select, and with both packages installed one of the two bundles was never served. If you have both, remove the other one now. See the upgrade guide.

[!IMPORTANT] A ⭐ costs you nothing and helps other developers find this package. Sponsoring keeps it compatible with every new Laravel release.

What it does

Nova already has dependent fields. dependsOn() re-renders a field whenever another one changes, and inside that callback you can set options() from the new parent value. If your option sets are small and already in memory — a status list, twenty categories — use it, and skip this package. This one exists for the options that are too many to send, or that do not live in your database at all.

  • The option set never has to fit in the form payload. Eight thousand cities are not serialized into the page on the chance somebody opens the dropdown.
  • Options can come from anywhere. A closure, an Eloquent model, a relation, a backed enum, a cached HTTP call.
  • Search runs in SQL, across the columns you name, not in the browser over a list it was handed.
  • It renders a label on index and detail, so the duplicate Text field goes away with it.
  • It refuses values that were never selectable, with a single membership query rather than a materialized Rule::in.

It is built on top of dependsOn() rather than beside it, so hide(), show(), your own dependsOn() callbacks and action modals all keep working — which the 1.x field could not manage.

Requirements

  • PHP 8.3+
  • Laravel 12 or 13
  • Nova 5, licensed separately

Installation

composer require gabrielesbaiz/nova-ajax-select

php artisan vendor:publish --tag=nova-ajax-select-config
php artisan vendor:publish --tag=nova-ajax-select-lang

The service provider is auto-discovered and the compiled field ships with the package: no migrations, no tables, no assets to build. Both publish steps are optional — the defaults work untouched.

Full installation guide →

Documentation

Documentation site Everything: install, configure, operate.
Guide Every feature, in the order you need it.
API reference Every method, without the prose.
Upgrading from 1.x Read before you start.
SECURITY.md · CONTRIBUTING.md The threat model, and how to build.
CHANGELOG.md What changed, and when.

Testing

composer test        # Pest
composer format      # Pint
npm test             # Vitest
npm run build        # compile dist/

There is no CI. Those four commands are the contract.

Contributing

Thank you for considering contributing. The guide is in CONTRIBUTING.md.

Security vulnerabilities

Please review SECURITY.md for reporting a vulnerability. Please do not open a public issue.

Credits

Written and maintained by Gabriele Sbaiz.

The original field was written by alexwenzel and dillingham; this package began as a fork of it and owes them the idea. It builds on Laravel and Laravel Nova.

Support this package

If it is useful to you:

  • ⭐ Star the repo. Free, thirty seconds, and it is the first signal other developers look at.
  • ❤️ Become a sponsor. From $5 a month.
  • 🐛 Open a good issue. A clear reproduction is worth more than you think.
  • 🗣️ Tell another Laravel developer. Word of mouth is how packages survive.

Sponsor on GitHub

Disclaimer

This package is provided as is, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, title and non-infringement. To the fullest extent permitted by applicable law, in no event shall the authors, copyright holders or contributors be liable for any claim, damages or other liability — whether in an action of contract, tort or otherwise — arising from, out of or in connection with this package or its use, including without limitation any direct, indirect, incidental, special, exemplary, consequential or punitive damages, loss of data, loss of profits, business interruption, or unauthorised access to or disclosure of information.

This package executes application-supplied closures during authorized Nova requests and can cache their results. Whoever deploys it is responsible for what those closures return and who may see it. That responsibility includes, and is not limited to, scoping option queries to the current user or tenant, setting cacheScope() when cached options are not global, deciding whether option validation is sufficient for your threat model, and reviewing the code yourself before putting it in front of data you cannot afford to leak. Nothing here constitutes security, legal or compliance advice.

Use of this package is entirely at your own risk.

License

MIT. See LICENSE.md. The MIT licence's warranty disclaimer and limitation of liability apply in full, alongside the disclaimer above.

Related Packages

gabrielesbaiz/nova-field-map

Leaflet map field for Laravel Nova 5 with GeoJSON, editable markers, drawing, cl...

16,284 0
gabrielesbaiz/nova-field-json

Composable JSON fields and a JSON editor field for Laravel Nova.

16,117 0
gabrielesbaiz/nova-card-html

A Laravel Nova card that renders HTML, Markdown or Blade content, with lazy load...

16,033 0
vyuldashev/nova-permission

A Laravel Nova tool for Spatie's Permission library.

2,638,820 429
spatie/nova-tags-field

A tags field for Nova apps

2,275,192 301