This is an Yii framework 2.0 widget of the Select2 replacement for select boxes with styles for the Materialize CSS Framework.
The preferred way to install this extension is through composer.
Either run
php composer.phar require yii-ui/yii2-materialize-select2
or add
"yii-ui/yii2-materialize-select2": "~1.1.0"
to the require section of your composer.json
file.
as active form element:
use yiiui\yii2materializeselect2\Select2:
echo $form->field($model, 'attribute')->widget(Select2::class, [
'items' => [1 => 'Apple', 2 => 'Banana'],
'options' => [
'placeholder' => 'Select your favourite',
],
'clientOptions' => [
'allowClear' => true
],
]);
or as widget:
Select2::widget([
'name' => 'input-name',
'value' => 2,
'items' => [1 => 'Apple', 2 => 'Banana'],
'options' => [
'placeholder' => 'Select your favourite',
],
'clientOptions' => [
'allowClear' => true
],
]);
More Examples will be added soon at https://www.yii-ui.com/yii2-materialize-select2. For plugin configuration see Select2 Documentation.
Documentation will be added soon at https://www.yii-ui.com/yii2-materialize-select2.
yii2-materialize-select2 is released under the MIT License. See the LICENSE.md for details.