add badges to menu ?

How do i add badge to yii2 menu ? similar to this one ( http://getbootstrap.com/components/#badges )

this is my menu code




NavBar::begin([

    'brandLabel' => 'Yii2 Framework',

    'brandUrl' => Yii::$app->homeUrl,

    'options' => [

        'class' => 'navbar-inverse navbar-fixed-top',

    ],

]);


$menuItems[] = [

    'label' => 'Documents Manager',

    'url' => '/folder'

];


echo Nav::widget([

    'options' => ['class' => 'navbar-nav navbar-right'],

    'items' => $menuItems,

]);

NavBar::end();



Just add it to the label.




'label' => 'Messages ' . Html::tag('span', '111', ['class' => 'badge']), 



Good Day Bizley!

I just tried in my 2.0.5 basic application and the output generated is:




My Menu Label <span class="badge">111</span>



Does this work in your app?

Best Regards

Oops, good spot! Forgot about:




echo Nav::widget(['encodeLabels' => false])



works perfect. thanks guys. this is my new code




NavBar::begin([

    'brandLabel' => 'Yii2 Framework',

    'brandUrl' => Yii::$app->homeUrl,

    'options' => [

        'class' => 'navbar-inverse navbar-fixed-top',

    ],

]);


$menuItems[] = [

    'label' => 'Documents Manager' . Html::tag('span', '111', ['class' => 'badge']),

    'url' => '/folder'

];


echo Nav::widget([

    'options' => ['class' => 'navbar-nav navbar-right'],

    'items' => $menuItems,

    'encodeLabels' => false

]);

NavBar::end();