Sidebar can contain the entire content of the product and allows users a quick access to a specific piece of content. The left arrow allows the user to retract or expand the sidebar.
We are undergoing a migration, the following examples might not be up-to-date.
Please refer directly to the Storybook documentation based on your preferred framework.
The nj-sidebar component has a modular structure. It is composed of several sub-elements that you can mix and match to achieve the desired result:
.nj-sidebar is the wrapper element:
if you want the sidebar to retract and expand, pass it an id and use it in the .nj-sidebar__collapse element (see below).
data-close-on-interact-out="true" attribute allows the sidebar to retract if you click outside it
.nj-sidebar--folded to fold the sidebar
.nj-sidebar--no-motion to remove the fold animation
.nj-sidebar__brand holds the brand logotype.
tt requires two images, one when it is expanded and one when it is retracted (use the square version)
.nj-sidebar__navigation is a wrapper for the navigation list elements
we provide an example of a nav with the nj-list component
we also provide a .nj-sidebar__navigation--footer modifier that anchors it at the bottom (see full example below).
.nj-sidebar__collapse houses the button that folds / expands the sidebar if needed
.nj-sidebar-content is the wrapper element used for all the content outside the sidebar. It wraps your content so that it behaves correctly with the fixed sidebar.
This div has the .nj-sidebar-content class. It's mandatory to have the right behavior with a fixed sidebar.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab accusamus amet debitis, esse est expedita harum magnam nesciunt nulla officia quam, quis quos soluta ut voluptas? Fugit libero minima perspiciatis.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab accusamus amet debitis, esse est expedita harum magnam nesciunt nulla officia quam, quis quos soluta ut voluptas? Fugit libero minima perspiciatis.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab accusamus amet debitis, esse est expedita harum magnam nesciunt nulla officia quam, quis quos soluta ut voluptas? Fugit libero minima perspiciatis.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab accusamus amet debitis, esse est expedita harum magnam nesciunt nulla officia quam, quis quos soluta ut voluptas? Fugit libero minima perspiciatis.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab accusamus amet debitis, esse est expedita harum magnam nesciunt nulla officia quam, quis quos soluta ut voluptas? Fugit libero minima perspiciatis.
Folded version
Add .nj-sidebar--folded class on <div class="nj-sidebar"> tag to have a folded version of the sidebar.
Sidebar with navbar
For this example, we made a specific page to show the sidebar with a navbar for a better user experience.