Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Material Design Lite navigation

How can I make submenu items in the navigation?

<!-- Navigation -->
  <nav class="mdl-navigation">
    <a class="mdl-navigation__link" href="">Link</a>
    <a class="mdl-navigation__link" href="">Link</a>
    <a class="mdl-navigation__link" href="">Link</a>
    <a class="mdl-navigation__link" href="">Link</a>
  </nav>

I can't use <ul> <li> with it. What is the correct class?

like image 259
Matt P Avatar asked Jul 10 '15 21:07

Matt P


1 Answers

MDL doesn't seem to support sub menus natively just yet. However there are classes for menus you can use as sub menus:

http://www.getmdl.io/components/index.html#menus-section

So in your code you might look like this:

<!-- Left aligned menu below button -->
<nav class="mdl-navigation">
  <a id="submenu" class="mdl-navigation__link" href="#">Link</a>
  <a class="mdl-navigation__link" href="">Link</a>
  <a class="mdl-navigation__link" href="">Link</a>
  <a class="mdl-navigation__link" href="">Link</a>
</nav>

<!-- sub menu only visible when clicked on the link above -->
<ul class="mdl-menu mdl-menu--bottom-left mdl-js-menu mdl-js-ripple-effect"
    for="submenu">
  <li class="mdl-menu__item">Some Action</li>
  <li class="mdl-menu__item">Another Action</li>
  <li disabled class="mdl-menu__item">Disabled Action</li>
  <li class="mdl-menu__item">Yet Another Action</li>
</ul>

Make sure to have # inside your href.

like image 120
sam Avatar answered Nov 09 '22 14:11

sam