Menu Components

    Vertical menu component.

    Accepts a list of menu items and renders them accordingly. Supports multi-level menus.

    Basic example

    Usage

    import { Menu } from '@paljs/ui/Menu';
    import { Link } from 'gatsby';
    
    function Layout() {
      return <Menu items={items} Link={Link} />;}

    Use menu Ref methods like this example:

    Pass Sidebar toggle method to menu to hide sidebar when click on link

    import React, { useRef } from 'react';
    
    function Layout() {
      const sidebarRef = useRef();
    
      return (
        <Sidebar ref={sidebarRef}>
          <Menu items={items} Link={Link} toggleSidebar={() => sidebarRef.current.hide()} />
        </Sidebar>
      );
    }