use yii\helpers\Html; $items = [1 => 'Honda', 2 => 'Toyota', 3 => 'Ford']; echo Html::listBox('car', 2, $items);
use yii\helpers\Html; $items = [1 => 'Red', 2 => 'Blue', 3 => 'Green']; $options = [ 2 => ['disabled' => true], 3 => ['class' => 'bold'], ]; echo Html::listBox('color', null, $items, ['options' => $options]);This will generate an HTML select list box with three options: Red, Blue and Green. The second option (Blue) will be disabled, and the third option (Green) will have a 'bold' class added to it. Package library: The Html listBox helper is part of the Yii framework's `yii\helpers` package.