coderius/yii2-toggle-switcher-widget

Yii 2 toggle-switcher-widget

1.0.0 2018-09-06 15:35 UTC

This package is auto-updated.

Last update: 2024-12-11 15:18:33 UTC


README

This widget will help to replace the checkbox in the form with a nice switch.

alt text alt text

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require "coderius/yii2-toggle-switcher-widget" "@dev"

or

composer require "coderius/yii2-toggle-switcher-widget" "@dev"

or add

"coderius/yii2-toggle-switcher-widget" : "@dev"

to the require section of your application's composer.json file.

Usage

How to basic use widget:

<?php 
    echo $form->field($model, 'flagActive')->widget(ToggleSwitchWidget::classname(), [
        'type' => ToggleSwitchWidget::CHECKBOX
    ]); 
?>

Or more short notice (ToggleSwitchWidget::CHECKBOX is default type value in widget):

<?= $form->field($model, 'status')->widget(ToggleSwitchWidget::classname()); ?>