2amigos/yii2-switchery-widget iOS 7 style switch widget for Yii2.

extension2amigosswitchery

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.

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

Changelog

Changelog

All Notable changes to yii2-switchery-widget will be documented in this file

NEXT - YYYY-MM-DD

Changed

  • Nothing

Added

  • Nothing

Deprecated

  • Nothing

Fixed

  • Nothing

Removed

  • Nothing

Security

  • Nothing

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

Comments



1.0.2 is the latest of 3 releases



BSD-3-Clause license
Stats
7 github stars & 1 github forks
29 downloads in the last day
829 downloads in the last 30 days
43572 total downloads