Skip to content

Keko-94/nova-toggle

 
 

Repository files navigation

Toggle Field

A drop in replacement for the default Boolean field

Toggle In Action

Installation

Same as most other Nova Packages

composer require davidpiesse/nova-toggle

Usage

The Toggle has all the same options as the Boolean field so you can set the values to be stored in the Model.

use Davidpiesse\NovaToggle\Toggle;

You can set visual parameters

Labels

You can show both, or each state label

Toggle::make('Active')
    ->showLabels() //Both labels
    ->showOnlyTrueLabel() //True label only
    ->showOnlyFalseLabel() //False label only

To set the text you can use either or both of the following. You must also set the visibility of the labels as described above.

Toggle::make('Active')
    ->showLabels()
    ->trueLabel('Tru Dat')
    ->falseLabel('Nah Dawg')

The defaults are 'True' and 'False'

About

Laravel Nova Toggle Field

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Vue 48.8%
  • PHP 25.9%
  • JavaScript 24.5%
  • CSS 0.8%