2amigos/yii2-switchery-widget

This package is abandoned and no longer maintained. No replacement package was suggested.

iOS 7 style switch widget for Yii2.

Installs: 52 857

Dependents: 0

Suggesters: 0

Security: 0

Stars: 7

Watchers: 6

Forks: 1

Open Issues: 1

Type:yii2-extension

1.0.2 2017-06-26 14:55 UTC

This package is auto-updated.

Last update: 2023-08-16 03:18:33 UTC


README

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.

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