@density/ui-navbar

3.0.3 • Public • Published

Navbar

The navbar is a navigation element that lives on the top of the screen.

Mobile usage

The navbar has a prop that can be passed to it called mobileSidebar - this prop expects a function that returns a list of NavbarMobileItem components. Here's an example:

<Navbar mobileSidebar={(closeSidebar, openSidebar) => [
  {/* Mobile navbar items: */}
  <NavbarMobileItem />,
  <NavbarMobileItem />,
  <NavbarMobileItem />,
]}>
  {/* Normal navbar items: */}
  <NavbarItem />
  <NavbarItem />
  <NavbarItem />
</Navbar>

Also, two callbacks are passed to the mobileSidebar function: one to open the sidebar and one to close the sidebar. Here's one in action:

<Navbar mobileSidebar={(closeSidebar, openSidebar) => [
  {/* When the user clicks the first item in the sidebar, close the sidebar. */}
  <NavbarMobileItem onClick={closeSidebar} />,
  <NavbarMobileItem />,
  <NavbarMobileItem />,
]}>
  {/* Normal navbar items: */}
  <NavbarItem />
  <NavbarItem />
  <NavbarItem />
</Navbar>

/@density/ui-navbar/

    Package Sidebar

    Install

    npm i @density/ui-navbar

    Weekly Downloads

    1

    Version

    3.0.3

    License

    MIT

    Unpacked Size

    55.6 kB

    Total Files

    8

    Last publish

    Collaborators

    • 1egoman
    • jshanley
    • density-ci
    • rjgrazioli
    • cat.density