Skip to content

coderius/yii2-toggle-switcher-widget

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Toggle switcher widget for Yii2

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()); ?>