Skip to content

About

Yii2 wrapper for iOS 7 style switches for your checkboxes

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

29 Commits

Folders and files

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 s4studio/yii2-switchery-widget

or add inside compsoer.json

"s4studio/yii2-switchery-widget": "*"

to the require section of your composer.json file and add:

"repositories": [
    {
      "type": "package",
      "package": {
        "name": "bower-asset/switchery",
        "version": "0.8.2",
        "type": "bower-asset",
        "dist": {
          "type": "zip",
          "url": "https://github.com/abpetkov/switchery/archive/refs/tags/0.8.2.zip"
        }
      }
    }
  ]

Usage

use s4studio\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 s4studio.pl

About

Yii2 wrapper for iOS 7 style switches for your checkboxes

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages