naif/toggle-switch-field

A Toggle Switch Field for Nova 4.

Downloads

4075

Stars

4

Version

1.1.4

Toggle Switch Field for Nova 4

For Toggle Switch Field for Nova 3 go to https://github.com/naifalshaye/toggle-switch

Features:

  • Set custom color using hex color code
  • Toggle or Icon align. Default (left)
  • Toggle Switch in Index to update value instead of icons. Default (true)
  • Toggle Switch in Detail to update value instead of icons. Default (true)

Requirements

  • PHP 8.0 or higher
  • Nova 4

Installation

You can install the package into a Laravel app that uses Nova via composer:

composer require naif/toggle-switch-field

Usage

Table column migration

$table->boolean('toggle')->nullable()->default(true);

Add the field to Nova Resource

  public function fields(NovaRequest $request)
    {
        return [
           ToggleSwitchField::make('Toggle','toggle')
                ->color('#3AB95A')
                ->toggleAlign('center')
                ->indexToggle(false)
                ->detailToggle(false),
        ];
    }

Screenshots

Custom hex color code


Detail Page Toggle Switch On



Detail Page Toggle Switch Off



Detail Page Icons On



Detail Page Icons Off



Edit Page Toggle Switch On




Edit Page Toggle Switch Off




Index Page Toggle Switch



Index Page icons



Support:

[email protected]

https://naif.io

Bug Tracker:

https://github.com/naifalshaye/toggle-switch-field/issues

License

The MIT License (MIT). Please see License File for more information.

naifalshaye

Author

naifalshaye