Switch
You're browsing the documentation for an old version of MoonShine. Consider upgrading your project to MoonShine 2.x.
    Extends
    
    Checkbox
    
        * has the same features    
use MoonShine\Fields\SwitchBoolean; //...public function fields(): array{    return [        SwitchBoolean::make('Publish', 'active')    ];} //...
use MoonShine\Fields\SwitchBoolean; //...public function fields(): array{    return [        SwitchBoolean::make('Publish', 'active')            ->onValue(1) // Active value of a form element            ->offValue(0) // Inactive value of a form element    ];} //...
use MoonShine\Fields\SwitchBoolean; //...public function fields(): array{    return [        SwitchBoolean::make('Publish', 'active')            ->autoUpdate(false) // The option to change on the main page is disabled            ->autoUpdate(true) // The option to change on the home page is enabled            ->autoUpdate(fn() => true)    ];} //...
 
    
