akavov/yii2-bootstrap-tokenfield

Create elegant taggable fields with copy/paste and keyboard support using Bootstrap Tokefield

Installs: 2 406

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 1

Type:yii2-extension

0.1.0 2015-08-28 14:49 UTC

This package is not auto-updated.

Last update: 2024-04-13 15:50:23 UTC


README

Create elegant taggable fields with copy/paste and keyboard support using Bootstrap Tokefield (http://sliptree.github.io/bootstrap-tokenfield/)

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist akavov/yii2-bootstrap-tokenfield : "*"

or add

"akavov/yii2-bootstrap-tokenfield": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

<?= \akavov\tokenfield\Tokenfield::widget([
    'name' => 'inputName',
]);

to use autocomplete

<?= \akavov\tokenfield\Tokenfield::widget([
    'name' => 'inputName',
    "pluginOptions" => [
        'delimiter' => '#', // default ',' (comma)
        'showAutocompleteOnFocus' => true,
        'autocomplete' => [
            'source' => ['red','blue','green','yellow','violet','brown','purple','black','white'],
            'delay' => 100
        ],
    ],
]);

to use with ActiveForm

<?= $form->field($model, 'name')->widget(\akavov\tokenfield\Tokenfield::className(), [
    'pluginOptions' => [
        'delimiter' => '#', // default ',' (comma)
        'showAutocompleteOnFocus' => true,
        'autocomplete' => [
            'source' => ['red','blue','green','yellow','violet','brown','purple','black','white'],
            'delay' => 100
        ],
    ],
]); ?>

TODO

  1. Add ability to choose between jqueryui and typeahead
  2. Test