It’s hard to believe Yii would have instabilities, but I believe that’s what I’m seeing. Using yii\bootstrap5\Dropdown I can only see Dropdown prepared in one instance, but not the default instance the docs refer to.
Not working:
<div class="dropdown">
<a href="#" data-toggle="dropdown" class="dropdown-toggle">Label <b class="caret"></b></a>
<?=
Dropdown::widget([
'items' => [
['label' => 'DropdownA', 'url' => '/'],
['label' => 'DropdownB', 'url' => '#'],
],
]);
?>
</div>
Two other working examples:
<?= Html::dropDownList('dropdn', null, [
'creator' => 'A',
'user' => 'B',
], ['id' => 'mb-3', 'class'=>'btn btn-secondary dropdown-large', 'prompt'=>'Select Account Type', 'onchange' => 'run()']) ?>
<?=
ButtonDropdown::widget([
'label' => 'Button Dropdown',
'dropdown' => [
'items' => [
['label' => 'Action', 'url' => '#'],
['label' => 'Submenu 1', 'items' => [
['label' => 'Action', 'url' => '#'],
['label' => 'Another action', 'url' => '#'],
['label' => 'Something else here', 'url' => '#'],
'<div class="dropdown-divider"></div>',
['label' => 'Submenu 2', 'items' => [
['label' => 'Action', 'url' => '#'],
['label' => 'Another action', 'url' => '#'],
['label' => 'Something else here', 'url' => '#'],
'<div class="dropdown-divider"></div>',
['label' => 'Separated link', 'url' => '#'],
]],
]],
['label' => 'Something else here', 'url' => '#'],
'<div class="dropdown-divider"></div>',
['label' => 'Separated link', 'url' => '#'],
],
],
'buttonOptions' => ['class' => 'btn-outline-secondary']
]);
?>
Classes are loaded w/o issue. I’ve actually just got yii\bootstrap5\ButtonDropdown working in the same format that’s desired. I’ve been creating this post for 20 mins tryin to make sure its a clear/HQ post.
Here’s a gif with the three dropdowns.