Here you can find examples of how to create toolbars on Firefox OS, as well as downloads for the CSS and image resources used by the built-in apps on Firefox OS. You can copy these resources into your app and make use of them to build apps that match these apps' appearances.
Implementing toolbars
To implement a toolbar using the style shown here, place the CSS and media files into your app and then import the CSS using the @import
at-rule:
@import url(resources/toolbars.css);
Make sure the media files are in the location expected by the CSS (either by placing them in a corresponding location or by revising the CSS).
The toolbar is built using a <div>
block with the ARIA role "toolbar". You then create at least one, but no more than two, unordered lists using the <ul>
element. If you provide only one list, it is anchored to the right end of the toolbar. If you provide two lists, the first is anchored to the left end of the toolbar, and the second list is anchored to the right end of the toolbar.
Each toolbar button is then a <button>
contained within a <li>
in those lists.
Example
HTML to create the toolbar
The HTML below creates a toolbar. It has a delete button at the left edge of the toolbar, and mark, send, move, and share buttons at the right end of the toolbar.
<body role="application"> <div role="toolbar"> <ul> <li><button class="pack-icon-delete" href="#delete-email-dialog">Delete</button></li> </ul> <ul> <li><button class="pack-icon-mark">Mark</button></li> <li><button class="pack-icon-send">Send</button></li> <li><button class="pack-icon-move">Move</button></li> <li><button class="pack-icon-share">Share</button></li> </ul> </div> </body>
CSS
The CSS here defines the icons for the toolbar buttons.
@import url(https://developer.mozilla.org/media/gaia/shared/style_unstable/toolbars.css);@import url(https://developer.mozilla.org/media/gaia/shared/style/confirm.css); @import url('https://developer.mozilla.org/media/css/gaia.css'); html, body { margin: 0; padding: 0; font-size: 10px; height: 100%; overflow-x: hidden; background: #000 url(https://mdn.mozillademos.org/files/4655/fx_logo_white_backdrop.jpg) fixed; } body { background: none; }
[role="toolbar"] .pack-icon-mark { background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+ID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1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo4NDA1RDQxQUE3MjA2ODExODhDNkE3NjAxQjM4MUZDNSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpDOUMyRkJBM0REODYxMUUxQjVDNEE4QjczREVCRENENCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpDOUMyRkJBMkREODYxMUUxQjVDNEE4QjczREVCRENENCIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M1IE1hY2ludG9zaCI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjk4MjBGQzc5QjkyMDY4MTE4OEM2QjcwQTAwNDE1NjQ1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjg0MDVENDFBQTcyMDY4MTE4OEM2QTc2MDFCMzgxRkM1Ii8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+PB4wWgAAANFJREFUeNpi/P//P8NAAsZRBww1B7ACsSMQuwCxJhBzAPEPIL4OxHuAeD8Q/6amA2SB2AyImaB8OSDuAeIdQHwASZ0HEDsAcQkQP4KK/QPiU0D8GK8LQA7AgQOA+Od/ygBIvx8eO/CGwB0gVqZCNIPMUSUnCt5RMa0JDdlcsBuJ7YrGJ1bMlRIHIEsyovGJFWPEZwETwwCDUQeMOmDUAaMOGHXAkHJAGgViVKkNya7yKQmBkxRafojSEOACYlNoc5xU8BvqgR+jPaNRB+ADAAEGAKG8wdkMfRTuAAAAAElFTkSuQmCC); }
Handling toolbar actions
We need to talk about how to handle the toolbar clicks to do things.
Working demo
You can try out the toolbar in this live demonstration.
Firefox OS live demos generally require a Gecko-based browser, and work best in recent builds of Firefox.