PHPackages                             kartik-v/yii2-bootstrap5-dropdown - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. kartik-v/yii2-bootstrap5-dropdown

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

kartik-v/yii2-bootstrap5-dropdown
=================================

Enhanced Bootstrap 4 dropdown widget for Yii2 with nested submenu support

v1.0.2(4y ago)2569.3k—1.1%17BSD-3-ClausePHP

Since Sep 1Pushed 4y ago1 watchersCompare

[ Source](https://github.com/kartik-v/yii2-bootstrap5-dropdown)[ Packagist](https://packagist.org/packages/kartik-v/yii2-bootstrap5-dropdown)[ Docs](https://github.com/kartik-v/yii2-bootstrap5-dropdown)[ RSS](/packages/kartik-v-yii2-bootstrap5-dropdown/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (7)

 [ ![Krajee Logo](https://camo.githubusercontent.com/4addfbb3869c3fc7d79befea4f06d9cf3655a686fb503df0da1d725859cfdef9/687474703a2f2f6b617274696b2d762e6769746875622e696f2f626f6f7473747261702d66696c65696e7075742d73616d706c65732f73616d706c65732f6b72616a65652d6c6f676f2d622e706e67) ](http://demos.krajee.com "Krajee Demos")
 yii2-bootstrap5-dropdown ---

 [![Donate](https://camo.githubusercontent.com/0336bc43d88554a3f2d6c74dddf312bc2c65c2eacca70d83ae40f5567098d00e/68747470733a2f2f6b617274696b2d762e6769746875622e696f2f626f6f7473747261702d66696c65696e7075742d73616d706c65732f73616d706c65732f646f6e6174652e706e67)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DTP3NZQ6G2AYU "Donate via Paypal") [![kartikv](https://camo.githubusercontent.com/0cf29a542375e1a46e84d8bf5805a4e5c0a6ee98b6547ccdc0c55eed49d99c69/68747470733a2f2f63646e2e6275796d6561636f666665652e636f6d2f627574746f6e732f76322f64656661756c742d79656c6c6f772e706e67)](https://www.buymeacoffee.com/kartikv "Buy me a coffee")
===========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#------------------------yii2-bootstrap5-dropdown------------------)

[![Stable Version](https://camo.githubusercontent.com/7fd5d6b21aeecbbf0c622a1c66b7b4b16772225e09ed85117c1fe0caca3d8c81/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d626f6f747374726170352d64726f70646f776e2f762f737461626c65)](https://packagist.org/packages/kartik-v/yii2-bootstrap5-dropdown)[![Unstable Version](https://camo.githubusercontent.com/530b3d46a9948634fc601d634f1dfc336421a4bc24be57fa00291231177013eb/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d626f6f747374726170352d64726f70646f776e2f762f756e737461626c65)](https://packagist.org/packages/kartik-v/yii2-bootstrap5-dropdown)[![License](https://camo.githubusercontent.com/611e813f19232d352f34b7cc7c4776398c7ecd929940e627da8db7fdf6ff3f7c/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d626f6f747374726170352d64726f70646f776e2f6c6963656e7365)](https://packagist.org/packages/kartik-v/yii2-bootstrap5-dropdown)[![Total Downloads](https://camo.githubusercontent.com/e204ac1226bf54e5917023c7f335d93c1dcf02eef1ecf8260bb914ae8683c9cf/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d626f6f747374726170352d64726f70646f776e2f646f776e6c6f616473)](https://packagist.org/packages/kartik-v/yii2-bootstrap5-dropdown)[![Monthly Downloads](https://camo.githubusercontent.com/b7f79421b26859a92d1076f4abbccd21e31ddbfa263375d0d29001bc4b647619/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d626f6f747374726170352d64726f70646f776e2f642f6d6f6e74686c79)](https://packagist.org/packages/kartik-v/yii2-bootstrap5-dropdown)[![Daily Downloads](https://camo.githubusercontent.com/5aa03011c97dd4437042e67b272f838e7af77731147dbee536b71cd94fceaab2/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d626f6f747374726170352d64726f70646f776e2f642f6461696c79)](https://packagist.org/packages/kartik-v/yii2-bootstrap5-dropdown)

Enhanced Bootstrap 5.x dropdown widget for Yii2 framework with nested submenu support.

Docs &amp; Demo
---------------

[](#docs--demo)

You can see detailed [docs &amp; demos](https://demos.krajee.com/bootstrap5-dropdown) and the API [code documentation](https://docs.krajee.com/kartik-bs5dropdown-buttondropdown) on usage of the extension.

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

> NOTE: Check the [composer.json](https://github.com/kartik-v/yii2-bootstrap5-dropdown/blob/master/composer.json) for this extension's requirements and dependencies. Read this [web tip /wiki](http://webtips.krajee.com/setting-composer-minimum-stability-application/) on setting the `minimum-stability` settings for your application's composer.json.

Either run

```
$ php composer.phar require kartik-v/yii2-bootstrap5-dropdown "@dev"

```

or add

```
"kartik-v/yii2-bootstrap5-dropdown": "@dev"

```

to the `require` section of your `composer.json` file.

Usage
-----

[](#usage)

### Dropdown Menu NavBar

[](#dropdown-menu-navbar)

```
use yii\bootstrap5\NavBar;
use yii\bootstrap5\Nav;
use kartik\bs4dropdown\Dropdown;
use yii\helpers\Html;

NavBar::begin(['brandLabel' => 'NavBar Test']);
echo Nav::widget([
    'items' => [
        ['label' => 'Home', 'url' => ['/site/index']],
        [
            'label' => 'Dropdown',
            'items' => [
                ['label' => 'Section 1', 'url' => '/'],
                ['label' => 'Section 2', 'url' => '#'],
                [
                     'label' => 'Section 3',
                     'items' => [
                         ['label' => 'Section 3.1', 'url' => '/'],
                         ['label' => 'Section 3.2', 'url' => '#'],
                         [
                             'label' => 'Section 3.3',
                             'items' => [
                                 ['label' => 'Section 3.3.1', 'url' => '/'],
                                 ['label' => 'Section 3.3.2', 'url' => '#'],
                             ],
                         ],
                     ],
                 ],
            ],
        ],
        ['label' => 'About', 'url' => ['/site/about']],
    ],
    'dropdownClass' => Dropdown::classname(), // use the custom dropdown
    'options' => ['class' => 'navbar-nav mr-auto'],
]);
NavBar::end();
