PHPackages                             kartik-v/yii2-bootstrap4-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-bootstrap4-dropdown

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

kartik-v/yii2-bootstrap4-dropdown
=================================

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

v1.0.4(4y ago)92.1M↓13.6%214BSD-3-ClausePHP

Since Sep 16Pushed 4y ago1 watchersCompare

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

READMEChangelog (5)Dependencies (1)Versions (6)Used By (14)

 [ ![Krajee Logo](https://camo.githubusercontent.com/4addfbb3869c3fc7d79befea4f06d9cf3655a686fb503df0da1d725859cfdef9/687474703a2f2f6b617274696b2d762e6769746875622e696f2f626f6f7473747261702d66696c65696e7075742d73616d706c65732f73616d706c65732f6b72616a65652d6c6f676f2d622e706e67) ](http://demos.krajee.com "Krajee Demos")
 yii2-bootstrap4-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-bootstrap4-dropdown------------------)

[![Stable Version](https://camo.githubusercontent.com/6dd3af1dbb19fe73e53e10ce4a298ecb87c9780cc222d6e2dfcc1450b6c15e84/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d626f6f747374726170342d64726f70646f776e2f762f737461626c65)](https://packagist.org/packages/kartik-v/yii2-bootstrap4-dropdown)[![Unstable Version](https://camo.githubusercontent.com/774e966a82516138404a283e48269b011f6980533448558e8ab77b66c9a70fcc/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d626f6f747374726170342d64726f70646f776e2f762f756e737461626c65)](https://packagist.org/packages/kartik-v/yii2-bootstrap4-dropdown)[![License](https://camo.githubusercontent.com/afd62152f76344bc4622d71cc8584465b961f75e2010827a9ed260b4a726185f/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d626f6f747374726170342d64726f70646f776e2f6c6963656e7365)](https://packagist.org/packages/kartik-v/yii2-bootstrap4-dropdown)[![Total Downloads](https://camo.githubusercontent.com/e510484aae442a71d88fde2082ca7aa76c2806ff47ca184030f28ea6159923f0/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d626f6f747374726170342d64726f70646f776e2f646f776e6c6f616473)](https://packagist.org/packages/kartik-v/yii2-bootstrap4-dropdown)[![Monthly Downloads](https://camo.githubusercontent.com/a0f330a20ac7d3e4c804720e80bcc256903f40872fcd4868ffa211b1e95cb376/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d626f6f747374726170342d64726f70646f776e2f642f6d6f6e74686c79)](https://packagist.org/packages/kartik-v/yii2-bootstrap4-dropdown)[![Daily Downloads](https://camo.githubusercontent.com/755ab5d1635c59b76f4b4d64b26c804c06c7c626c15342b0e8c5f91120067ae7/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d626f6f747374726170342d64726f70646f776e2f642f6461696c79)](https://packagist.org/packages/kartik-v/yii2-bootstrap4-dropdown)

Enhanced Bootstrap 4.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/bootstrap4-dropdown) and the API [code documentation](https://docs.krajee.com/kartik-bs4dropdown-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-bootstrap4-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-bootstrap4-dropdown "@dev"

```

or add

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

```

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

Usage
-----

[](#usage)

### Dropdown Menu NavBar

[](#dropdown-menu-navbar)

```
use yii\bootstrap4\NavBar;
use yii\bootstrap4\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();
