kak/navmenu

Yii2 navmenu widgets

Installs: 344

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Language:SCSS

Type:yii2-extension

0.0.2 2020-11-05 06:08 UTC

This package is auto-updated.

Last update: 2024-12-19 17:19:03 UTC


README

Sidebar, TopMenu, Tabs, widgets for Yii2

Preview

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist kak/navmenu "*"

or add

"kak/navmenu": "*"

to the require section of your composer.json file.

Usage Sidebar

Once the extension is installed, simply use it in your code by :

use kak\widgets\navmenu\Sidebar;
use yii\web\View;
use yii\web\Controller;
/**
 * @var $this View 
 * @var $context Controller 
*/
$context =  $this->context;
?>
<body>
<div class="wrap">
    <!-- $this->render('_top-menu') -->
    <!-- $this->render('_alerts') -->
    <!-- $this->render('_breadcrumbs') -->

    <?= Sidebar::widget([
            'theme' => Sidebar::THEME_BLACK,
            'items' => [[
                   'active' =>  $context->id === 'rbac' && $context->action->id === 'index',
                   'label' => 'RBAC', 
                   'url' => ['/rbac'],
                   'icon' => 'fa fa-shield'
                ],[
                   'items' => [/* ... */] 
                ]]
        ]);?>
    <div class="content wrap-sidebar-page-content"> <!-- <-- add class "wrap-sidebar-page-content" -->
        <div class="container-fluid">
             <?= $content ?>
        </div>
        or 
        <div class="container">
            <?= $content ?>
        </div>
    </div> 

    <!-- $this->render('_footer') -->
</div>   

Usage Tabs (responsive bootstrap tabs)

use kak\widgets\navmenu\Tabs;

echo Tabs::widget([
    'options' => ['class' => 'nav nav-tabs '],
    'items' => [
        ['label' => 'Stat for Month', 'url' => ['month'], 'active' => true],
        // ...
    ]
]);