Action menu 2.0 Implementation

This article gives you all you need to implement a v2.0 Action menu in your own app.

Live sample

The following gives you an idea of what the rendered menu would look like (the vertical scroll bar would not appear on the actual device.)

Code

Here is the code you'll need.

CSS

<link href="(your styles folder)/style/action_menu.css" rel="stylesheet" type="text/css">

The CSS can be found in the Gaia project 2.0 branch under shared/style/action_menu.css. Copy this into your own project, along with the associated resources.

HTML

Note: The CSS inside the <style> element isn't needed for the implementation: it is just for the purposes of this example.

<!doctype html>
<html>
<head>
  <link href="https://gaia-components.github.io/gaia-icons/gaia-icons-embedded.css" rel="stylesheet" type="text/css">
  <link href="https://mdn.github.io/gaia-2.0-bb/action_menu.css" rel="stylesheet" type="text/css">
  <style>
    html, body {
      font-family: sans-serif;
      margin: 0;
      padding: 0;
      font-size: 10px;
      background-color: #fff;
    }

    body {
      background: none;
    }
  </style>
</head>
<body>


<form role="dialog" data-type="action">
  <header>Title</header>
  <menu>
    <button type="button">Action 1</button>
    <button disabled>Action 2 (disabled)</button>
    <button type="button">Action 3</button>
    <button type="button">Action 4</button>
    <button disabled>Action 5 (disabled)</button>
    <button type="button">Action 6</button>
    <button type="button">Action 7</button>
    <button disabled>Action 8 (disabled)</button>
    <button type="button">Action 9</button>
    <button type="button">Cancel</button>
  </menu>
</form>

</body>
</html>

Note: Use <button type="button"> if you don't want your form to be submitted.

 

Document Tags and Contributors

 Contributors to this page: chrisdavidmills, chrisdavidmills-github
 Last updated by: chrisdavidmills,