useNav()
import useNav from "@intility/bifrost-react/hooks/useNav";The useNav hook returns an object with state accessors for the side and mobile menus. It has to be used from a descendant of the <Nav> component.
- bool
sideCollapsedis true when sidebar is collapsed (even if hidden for small screens) - function
setSideCollapsed(bool)provides your own mechanism for persisting collapse/expand sidebar state- NOTE: function will be undefined if not provided
- bool
mobileOpenis true when mobile nav is open (even if hidden for large screens) - function
setMobileOpen(bool)shows/hides the mobile nav (will still be hidden for large screens) - bool
isMobileis true when mobile hamburger menu button is displayed and sidebar is hidden avoid for SSR/SSG/Unit testing (depends onwindow.matchMedia)
Try resizing your window to test the mobile part of the demo.