What is the Selectize Widget?
Selectize is an extensible jQuery-based custom <select> UI control. It's useful for tagging, contact lists, country selectors, and so on. It clocks in at around ~7kb (gzipped). The goal is to provide a solid & usable experience with a clean and powerful API.
Installation
The preferred way to install this extension is through composer.
Either run
composer require 2amigos/yii2-selectize-widget:~1.0
or add the following to the require section of your application's composer.json
file:
"2amigos/yii2-selectize-widget" : "~1.0"
Usage example
Selectize has lots of configuration options. For further information, please check the Selectize plugin website.
Text input widget
To use text input widget add the following to the view
<?php
use dosamigos\selectize\SelectizeTextInput;
echo SelectizeTextInput::widget([
'name' => 'tags',
'value' => 'love, this, game',
'clientOptions' => [
// [...]
],
]);
?>
Dropdown list widget
To use dropdown list widget add the following to the view
use dosamigos\selectize\SelectizeDropDownList;
echo SelectizeDropDownList::widget([
'name' => 'tags',
'value' => ['love', 'this', 'game'],
'clientOptions' => [
// [...]
],
]);