naif/toggle-switch-field

A Toggle Switch Field for Nova 4.

Installs: 43 519

Dependents: 0

Suggesters: 0

Security: 0

Stars: 6

Watchers: 1

Forks: 5

Open Issues: 2

Language:Vue

pkg:composer/naif/toggle-switch-field

2.0.0 2025-01-05 15:57 UTC

This package is not auto-updated.

Last update: 2025-09-28 19:38:55 UTC


README

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 in Index and details to update value instead of icons. Default (true).
  • Allow multiple toggles in same resource.
  • Allow Disabled toggle (readonly) with Gray color.

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')->default(true);

* Add toggle fields to $fillable in Model

Add the field to Nova Resource

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

Screenshots

Custom hex color code






Support:

naif@naif.io

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.