Chosen Select Widget based on Chosen jQuery plugin chosen
The preferred way to install this extension is through composer.
Either run
composer require yii2mod/yii2-chosen-select
or add
"yii2mod/yii2-chosen-select": "^1.0"
to the require section of your composer.json.
- Usage with ActiveForm and model
echo $form->field($model, 'subject')->widget(\yii2mod\chosen\ChosenSelect::class, [
'items' => [
'first' => 'First',
'second' => 'Second'
],
]);
- Usage without a model
echo \yii2mod\chosen\ChosenSelect::widget([
'name' => 'select',
'items' => BooleanEnum::listData(),
'options' => [
'width' => '95%'
]
]);
You can find them on the options page