S
S
Sergey Krivosheev2017-10-18 13:24:42
css
Sergey Krivosheev, 2017-10-18 13:24:42

How to create a multi-level menu or list in Bootstrap?

Good afternoon. Is it possible using Nav to create such a menu?
59e72b61e21f9686807393.png
It is more like a multi-level list. Maybe some other component. It would be very good if there was a ready-made component within Yii2, so as not to draw it yourself. Because I think the task is standard, but I did not find information in the bootstrap documentation
https://github.com/leandrogehlen/yii2-treegrid similar functionality, I use it to edit menu items.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Maxim Timofeev, 2017-10-18
@webinar

Why don't you like yii\widgets\Menu?
www.yiiframework.com/doc-2.0/yii-widgets-menu.html
And the same nav is not limited to one level.

A
Alexey Sergeev, 2017-10-18
@SergeevAI

https://bootsnipp.com
Look for examples here

D
Dmitry, 2017-10-18
@slo_nik

Good afternoon.
It is enough to look into the documentation and the need to write a question disappears immediately.
Nav(items)
PS And there, at the link I gave, at the very beginning of the page, an example.
Read the documentation, don't be lazy!

echo Nav::widget([
    'items' => [
        [
            'label' => 'Home',
            'url' => ['site/index'],
            'linkOptions' => [...],
        ],
        [
            'label' => 'Dropdown',
            'items' => [
                 ['label' => 'Level 1 - Dropdown A', 'url' => '#'],
                 '<li class="divider"></li>',
                 '<li class="dropdown-header">Dropdown Header</li>',
                 ['label' => 'Level 1 - Dropdown B', 'url' => '#'],
            ],
        ],
        [
            'label' => 'Login',
            'url' => ['site/login'],
            'visible' => Yii::$app->user->isGuest
        ],
    ],
    'options' => ['class' =>'nav-pills'], // set this to nav-tab to get tab-styled navigation
]);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question