alexantr/yii2-colorpicker

Color picker input widget for Yii 2

Installs: 3 869

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 1

Forks: 0

Open Issues: 0

Type:yii2-extension

2.0.0 2018-02-09 14:08 UTC

This package is auto-updated.

Last update: 2024-10-23 15:12:15 UTC


README

This extension renders an input with jQuery MiniColors.

Latest Stable Version Total Downloads License

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
    ],
]) ?>