Releases: wamesk/laravel-nova-inline-toggle
1.1.0
Release Notes (v1.1.0)
New Features
- DependsOn support — The InlineToggle field now supports Nova's dependsOn() method, allowing you to reactively show/hide or modify the field based on other field values
- Readonly support on Index & Detail — Toggle buttons on index and detail views now respect the readonly() field option, preventing accidental toggling
Improvements
- Externalized laravel-nova in webpack config for proper module resolution
Usage Example
InlineToggle::make('Active', 'is_active')
->dependsOn('status', function (InlineToggle $field, NovaRequest $request, FormData $formData) {
if ($formData->status === 'archived') {
$field->hide();
}
});
1.0.0
Overview
A Laravel Nova field that provides an interactive toggle/switch with inline editing directly on the index page. Update boolean values with a single click — no need to open the edit form.
Features
Inline toggle on index page — CSS toggle switch that updates the database value via AJAX on click, with loading indicator and toast notifications
Configurable colors — Customize ON/OFF colors via ->onColor() and ->offColor() using hex values
Detail page support — Read-only colored badge by default, with optional inline toggle via ->inlineOnDetail()
Auto-contrast badge — Detail page badge automatically calculates contrasting text color (dark/white) based on background luminance
Form page — Standard checkbox input
Custom toast messages — Configure per-state messages (->onMessage(), ->offMessage()) or a general message (->successMessage(), ->errorMessage())
Nova compatible — Works with ->sortable(), ->filterable(), and all standard Nova field methods
Requirements
PHP 8.2+
Laravel 11.x
Laravel Nova 4.x
Installation
composer require wamesk/laravel-nova-inline-toggle
Quick Start
use Wame\InlineToggle\InlineToggle;
InlineToggle::make(__('Active'), 'is_active')
->onColor('#22c55e')
->offColor('#9ca3af')
->sortable()
->filterable(),
See README.md for full documentation and API reference.