This demo showcases a combined use of the default Main Layout, the Left Menu and parts of the Right Navbar to only style the menu itself on the RIGHT side.
sticky
position, and opening deep tree menus will render our navbar
unusable, so we've enabled the toggleSiblings
option via the specific attribute
data-toggle-siblings="true"
to solve that kind of issue.// navbar-combo.scss - navbar only
@import 'variables', 'mixins', 'root';
@include navbar-mobile-layout;
@include navbar-desktop-layout;
@include navbar-style;
@include nav-layout;
@include nav-style;
@include subnav-style;
.navbar {
@include main-menu;
}
navbar-mobile-layout
, navbar-desktop-layout
, navbar-style
,
nav-layout
and nav-style
mixins are used by all instances;.navbar
style rule to only include main-menu
mixin, to make sure
the subnav layout of this instance is separate and independent from the other two instances.The basic style of the main Navbar is customized with the following CSS variables wrapped in the .navbar
class:
// combo.html - .navbar only
.navbar {
--n-bg: #4a5848;
--n-primary-color: #0e8000;
--n-item-active-bg: var(--n-primary-color);
--n-subnav-padding-x: .5rem;
--n-subnav-padding-y: .5rem;
--n-subnav-bg: var(--n-bg);
--n-subnav-item-color: rgba(255,255,255,.55);
--n-subnav-item-active-bg: var(--n-primary-color);
--n-subnav-text-color: rgba(255,255,255,.55);
--n-subnav-link-color: rgba(255,255,255,.75);
--n-subnav-link-color-hover: rgba(255,255,255,.95);
--n-subnav-shadow: 2px 2px 4px 2px rgba(0,0,0,.35), 1px 1px 0 0 rgba(255,255,255,.15) inset;
--n-subnav-larger-width: calc(var(--n-subnav-width) * 3 + var(--n-subnav-padding-x) * 2);
}
As you can see, we've customized most colors of the main Navbar. Keep in mind that updating
--n-primary-color
will not automatically update your active menu item colors,
you will have to re-specify a value for --n-subnav-item-active-bg
; similarly
updating the --n-subnav-padding-x
variable will require updating the
--n-subnav-larger-width
which is the default width of a tyipical mega menu.
// navbar-combo.scss - side menus
.left {
@include left-side(1);
}
.right {
@include right-side(1);
}
left-side(1)
mixin, it uses an argument value of 1
, which
will merge the two selectors into one: .left.nav
;Side menus are customized via the following CSS variables:
// navbar-combo.scss - side menu
.sidebar {
--n-bg: #eee;
--n-item-hover-color: #fff;
--n-item-color: rgba(0,0,0,.55);
--n-link-color: var(--n-primary-color);
--n-item-hover-bg: #333;
--n-subnav-item-hover-bg: #444;
--n-subnav-item-hover-color: #eee;
--n-expanded-bg: rgba(0, 0, 0, 0.075);
--n-subnav-shadow: 1px 1px 4px 1px rgba(0,0,0,.25), 1px 1px 0 0 rgba(0,0,0,.15) inset;
}
.right {
--n-subnav-shadow: -1px 1px 4px 1px rgba(0,0,0,.25), -1px 1px 0 0 rgba(0,0,0,.15) inset;
}
The following SCSS is all you need to generate the styling for RTL languages:
// navbar-combo-rtl.scss - navbar and side menus
@include navbar-mobile-layout;
@include navbar-desktop-layout;
@include navbar-style;
@include nav-layout;
@include nav-style;
@include subnav-style;
.navbar {
@include main-menu-rtl;
}
.right {
@include left-side(1);
}
.left {
@include right-side(1);
}
Note the main-menu-rtl
mixin is used as well as the left-side
mixin used for
the right sidebar and the right-side
mixin used for the left sidebar.
The only concern remaining is to set the menu icons for <i class="parent-icon">
/
<svg class="parent-icon">
to match the text direction. You can of course not only
change the icons to match the text direction but also the order of the elements.
The same CSS variables showcased above are used in RTL mode.
Also on the left side you have the Left Menu were we used the menu without the wrapper. Another cool demo is of course the full right navbar, similar to this very page, go ahead and check it out.