Skip to content

Commit

Permalink
add README
Browse files Browse the repository at this point in the history
  • Loading branch information
TommyZheng committed Jan 9, 2017
1 parent f314029 commit 663baf8
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
Bootstrap ColorPicker Widget for Yii2
====================================

Renders a [Bootstrap ColorPicker plugin](https://github.com/itsjavi/bootstrap-colorpicker/).

Installation
------------
The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
composer require zgb7mtr/yii2-bootstrap-color-picker:~1.0
```
or add

```json
"zgb7mtr/yii2-bootstrap-color-picker" : "~1.0"
```

to the require section of your application's `composer.json` file.

Usage
-----

This widget renders a Bootstrap ColorPicker input control. Best suitable for model with date string attribute.

***Example of use with a form***
There are two ways of using it, with an `ActiveForm` instance or as a widget setting up its `model` and `attribute`.

```
<?php
use zgb7mtr\colorPicker\ColorPicker;
// as a widget
?>
<?= ColorPicker::widget([
'model' => $model,
'attribute' => 'color',
]);?>
<?php
// with an ActiveForm instance
?>
<?= $form->field($model, 'color')->widget(
ColorPicker::className());?>
```
***Example of use without a model***

```
<?php
use zgb7mtr\colorPicker\ColorPicker;
?>
<?= ColorPicker::widget([
'name' => 'Test',
'value' => '#CCCCCC'
]);?>
```

0 comments on commit 663baf8

Please sign in to comment.