Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Garbee/Dropdown-Component

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Dropdown Component

A quick dropdown system to be used with Material Design Lite.

WARNING: This is still very early.

Usage

To install the component

  1. Reference src/dropdown.js in your markup so it will be included as a script.
  2. Build MDL's Sass and add src/dropdown.scss after the rest of MDL.

Within your page

  1. Code an anchor to be the trigger for the dropdown. Give it the component-js-dropdown class to setup the dropdown menu. Also provided is a dropdown-navigation__header class that styles it like a normal menu item.
    <a class="dropdown-navigation__header component-js-dropdown" title="Gaming">
        Gaming
    </a>
  1. Add the arrow icons within the header. These will be displayed so users know the dropdown's state.
    <a class="dropdown-navigation__header component-js-dropdown" title="Gaming">
        Gaming
        <span class="material-icons dropdown-inactive">arrow_drop_down</span>
        <span class="material-icons dropdown-active ">arrow_drop_up</span>
    </a>
  1. The next child in the DOM should be menu this trigger will target. This element contains the anchors for the menu.
<div class="dropdown-navigation__menu">
    <a class="mdl-navigation__link" href="gaming/mtg" title="Magic: The Gathering">Magic: the Gathering</a>
    <a class="mdl-navigation__link" href="gaming/dnd" title="Dungeons & Dragons">Dungeons & Dragons</a>
</div>

Final code:

<a class="dropdown-navigation__header component-js-dropdown" title="Gaming">Gaming</a>
<div class="dropdown-navigation__menu">
    <a class="mdl-navigation__link" href="gaming/mtg" title="Magic: The Gathering">Magic: the Gathering</a>
    <a class="mdl-navigation__link" href="gaming/dnd" title="Dungeons & Dragons">Dungeons & Dragons</a>
</div>

About

Quick and simple dropdown menu component for MDL

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.