wire-elements/spotlight
Wire Elements Spotlight adds a Spotlight/Alfred-style command palette to Laravel via Livewire. Open with Ctrl/Cmd+K (or customize), search and run actions, and toggle from Livewire or JavaScript. Works with Alpine when using Livewire v2.
SpotlightCommand) allows for granular, reusable actions (e.g., navigation, CRUD operations, auth flows). This aligns well with Laravel’s service container and dependency injection, enabling clean, testable logic.@livewire('livewire-ui-spotlight')). Alpine.js is only needed for Livewire v2 (v3 uses native Livewire events).| Risk Area | Mitigation Strategy |
|---|---|
| Livewire Version Mismatch | Test compatibility with Livewire v2/v3 early. Use wire-elements/spotlight’s changelog for version notes. |
| Performance Overhead | Spotlight loads asynchronously (via Livewire). Monitor impact on initial page load. Bundle JS/CSS if needed. |
| Command Logic Complexity | Use dependency injection and Spotlight’s shouldBeShown to gate commands (e.g., auth/permissions). |
| Search Indexing | For large command sets, pre-filter commands (e.g., by user role) to avoid runtime overhead. |
| Alpine.js Dependency | Only required for Livewire v2. v3 uses native Livewire events, reducing friction. |
include_css=true work?execute methods)? (Devs or PMs?)| Phase | Action Items |
|---|---|
| Assessment | Audit existing navigation patterns. Identify top 3–5 pain points Spotlight could solve (e.g., deep nested menus, repetitive actions). |
| Pilot | Implement Spotlight in a non-critical section (e.g., admin panel). Start with 3–5 core commands (e.g., logout, search, settings). |
| Core Integration | 1. Install package: composer require wire-elements/spotlight.2. Publish config/views: php artisan vendor:publish --tag=livewire-ui-spotlight-config.3. Add Livewire directive to layout. |
| Command Rollout | Develop commands incrementally:- Use php artisan make:spotlight for boilerplate.- Register commands in config/livewire-ui-spotlight.php or AppServiceProvider.- Test with shouldBeShown for RBAC. |
| Optimization | - Bundle JS/CSS if using webpack.- Add synonyms for common user queries.- Monitor performance with >20 commands. |
| Dependency | Version Support | Workaround |
|---|---|---|
| Livewire | v2.x, v3.x | Test with target version early. Use wire-elements/spotlight’s docs. |
| Alpine.js | v3.x (Livewire v2 only) | Exclude if using Livewire v3. |
| TailwindCSS | Optional (via include_css) |
Set 'include_css' => true in config if not using Tailwind. |
| Laravel | 8.x, 9.x, 10.x | No known issues. |
| PHP | 8.0+ | Ensure server meets requirements. |
shouldBeShown for admins).composer why-not wire-elements/spotlight to check compatibility.$this->emit().dd() in execute() methods for troubleshooting.shouldBeShown logic or registration.How can I help you explore Laravel packages today?