Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Edit mode 2.0 implementation

This article gives you all you need to implement v2.0 Edit mode (Select mode) in your own app.

Live sample

The following gives you an idea of what the rendered Edit mode 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/edit_mode.css" rel="stylesheet" type="text/css">

The CSS can be found in the Gaia project 2.0 branch under shared/style/edit_mode.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://mdn.github.io/gaia-2.0-bb/headers.css" rel="stylesheet" type="text/css">
  <link href="https://mdn.github.io/gaia-2.0-bb/edit_mode.css" rel="stylesheet" type="text/css">
  <link href="https://gaia-components.github.io/gaia-icons/gaia-icons-embedded.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 role="application">

  <form role="dialog" data-type="edit">
    <section role="region">
      <header>
        <button><span class="icon icon-close">close</span></button>
        <menu type="toolbar">
          <button>done</button>
        </menu>
        <h1>Edit</h1>
      </header>
    </section>
    <menu>
      <button disabled>Deselect all</button>
      <button>Select all</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
 Last updated by: chrisdavidmills,