alexantr / yii2-colorpicker
Color picker input widget for Yii 2
Installs: 3 952
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- yiisoft/yii2: ~2.0.6
This package is auto-updated.
Last update: 2024-12-23 15:27:59 UTC
README
This extension renders an input with jQuery MiniColors.
Note: Version 1.x uses jscolor Color Picker
Installation
Install extension through composer:
composer require alexantr/yii2-colorpicker
Usage
The following code in a view file would render an input with color picker:
<?= alexantr\colorpicker\ColorPicker::widget(['name' => 'attributeName']) ?>
If you want to use this input widget in an ActiveForm, it can be done like this:
<?= $form->field($model, 'attributeName')->widget(alexantr\colorpicker\ColorPicker::className()) ?>
Configuring the jQuery MiniColors should be done using the clientOptions
attribute:
<?= alexantr\colorpicker\ColorPicker::widget([ 'name' => 'attributeName', 'clientOptions' => [ 'control' => 'wheel', 'letterCase' => 'uppercase', 'theme' => 'default', // the widget uses 'bootstrap' theme ], ]) ?>