panix / wgt-colorpicker
Widget colorpicker
Installs: 221
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Language:JavaScript
Type:pixelion-component
Requires
- panix/engine: *
This package is auto-updated.
Last update: 2025-03-29 00:38:10 UTC
README
Widget for Yii Framework 2.0 to use colorpicker
Installation
The preferred way to install this extension is through composer.
Either run
php composer require --prefer-dist panix/wgt-colorpicker "*"
or add
"panix/wgt-colorpicker": "*"
to the require section of your composer.json
file.
Usage
Once the extension is installed, simply use it in your code by :
<?php echo $form->field($model, 'color')->widget(ColorPicker::className(), [ ])->textInput(['maxlength' => 7]); ?>
Configuration
Опция | Тип | Описание |
---|---|---|
mode |
string | ColorPicker mode: textInput - presents a textfield with a color picker attached (default). flat - presents a color picker in flat mode. selector - attached to a square selector |
value |
string | The default color. String for hex color. Default is #000000 |
livePreview |
boolean | Whatever if the color values are filled in the fields while changing values on selector or a field. If false it may improve speed. Default is true |
fade |
boolean | Whetever the color picker will be animated Default is false |
slide |
boolean | Whetever the color picker will slide Default is false |
curtain |
boolean | Whetever the color picker will appear as a curtain Default is false |
timeFade |
int | Times for the effect delays Default is 500 |
timeSlide |
int | Times for the effect delays Default is 500 |
timeCurtain |
int | Times for the effect delays Default is 500 |
onShow |
string | Callback function triggered when the color picker is shown. |
onBeforeShow |
string | Callback function triggered before the color picker is shown. |
onHide |
string | Callback function triggered when the color picker is hidden. |
onChange |
string | Callback function triggered when the color is changed. |
onSubmit |
string | Callback function triggered when the color it is chosen. |
Examaple
<?php echo $form->field($model, 'color')->widget(ColorPicker::className(), [ 'onShow' => new JsExpression('function() {}), ])->textInput(['maxlength' => 7]); ?>