Skip to content
This repository was archived by the owner on Jul 27, 2023. It is now read-only.

2amigos/yii2-switchery-widget

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yii2-switchery-widget

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads

Yii2 wrapper for iOS 7 style switches for your checkboxes

Install

Via Composer

$ composer require 2amigos/yii2-switchery-widget

or add inside compsoer.json

"2amigos/yii2-switchery-widget": "*"

to the require section of your composer.json file.

Usage

use dosamigos\switchery\Switchery;
use yii\web\JsExpression;
 
 
// usage with model
echo $form->field($model, 'is_required')->widget(Switchery::className(), [
      'options' => [
          'label' => false
      ],
      'clientOptions' => [
          'color' => '#5fbeaa',
      ]
 ]);
 
 
// usage without model
echo Switchery::widget([
    'name' => 'is_required', 
    'value' => $model->is_required,
    'clientOptions' => [
        'color' => '#5FBEAA',
        'secondaryColor' => '#CCCCCC',
        'jackColor' => '#FFFFFF',
    ],
    'clientEvents' => [
        'change' => new JsExpression('function() {
            console.log("Cool! You changed my state.");
        }')
    ]
]);

Testing

$ phpunit

Contributing

Please see CONTRIBUTING for details.

Credits

License

The BSD License (BSD). Please see License File for more information.


web development has never been so fun
www.2amigos.us

About

Yii2 wrapper for iOS 7 style switches for your checkboxes

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages