Firefox OS Theme for Ratchet 2.0

Title

Title bar

Title bars are full width and docked to the top of the viewport.

Title

<header class="bar bar-nav">
    <h1 class="title">Title</h1>
    </header>
  

Title bar with buttons

Buttons in a title bar are left or right aligned and should be used for actions. Use the .pull-right or .pull-right utility classes to float the buttons. Also, be sure to place any floated elements bofore the title.

<header class="bar bar-nav">
    <a class="btn pull-left">
    Left
    </a>
    <a class="btn pull-right">
    Right
    </a>
    <h1 class="title">Title</h1>
    </header>
  

Title bar with icons

Icons can also be used for actions in toolbars. Again, be sure to use utility classes to float the icons into position.

Title

<header class="bar bar-nav">
    <a class="icon icon-left-nav pull-left"></a>
    <a class="icon icon-compose pull-right"></a>
    <h1 class="title">Title</h1>
    </header>
  

Title bar with link buttons and icons

Link buttons can be used in tool bars to remove the outline. Use these in conjuction with icons to recreate the nav feel from iOS7. Note the use of .btn-nav to bring the buttons a little bit closer to the edge of the viewport.

<header class="bar bar-nav">
    <a class="btn btn-link btn-nav pull-left">
    <span class="icon icon-left-nav"></span>
    Left
    </a>
    <a class="btn btn-link btn-nav pull-right">
    Right
    <span class="icon icon-right-nav"></span>
    </a>
    <h1 class="title">Title</h1>
    </header>
  

Title bar with segmented control

Title bars can also house segmented controls. Feel free to add accompanying buttons too. The control will automatically layout itself out correctly.

<header class="bar bar-nav">
    <a class="btn pull-left">
    Left
    </a>
    <a class="btn pull-right">
    Right
    </a>
    <div class="segmented-control">
    <a class="control-item active">One</a>
    <a class="control-item">Two</a>
    <a class="control-item">Three</a>
    </div>
    </header>
  

Tab bar

Use Ratchicons in the .tab-bar to represent different sections of your app.

<nav class="bar bar-tab">
    <a class="tab-item active" href="#">
    <span class="icon icon-home"></span>
    <span class="tab-label">Home</span>
    </a>
    <a class="tab-item" href="#">
    <span class="icon icon-person"></span>
    <span class="tab-label">Profile</span>
    </a>
    <a class="tab-item" href="#">
    <span class="icon icon-star-filled"></span>
    <span class="tab-label">Favorites</span>
    </a>
    <a class="tab-item" href="#">
    <span class="icon icon-search"></span>
    <span class="tab-label">Search</span>
    </a>
    <a class="tab-item" href="#">
    <span class="icon icon-gear"></span>
    <span class="tab-label">Settings</span>
    </a>
    </nav>
  

Note: Use push.js to actually change content.

Tab bar (labels only)

If you don't want to use icons, that's okay too. The text will appear larger to use the additional space.

<nav class="bar bar-tab">
    <a class="tab-item active" href="#">
    Label
    </a>
    <a class="tab-item" href="#">
    Label
    </a>
    <a class="tab-item" href="#">
    Label
    </a>
    </nav>
  

Note: Use push.js to actually change content.

Standard bars

Standard bars are basic fixed elements that can be positioned in four places. These can be used to house buttons, icons, or segmented controls (see following examples).

<!-- Segmented control in standard bar fixed to top -->
    <nav class="bar bar-standard">
    <div class="segmented-control">
    <a class="control-item active">Thing one</a>
    <a class="control-item">Thing two</a>
    <a class="control-item">Thing three</a>
    </div>
    </nav>

    <!-- Block button in standard bar fixed below top bar -->
    <div class="bar bar-standard bar-header-secondary">
    <a class="btn btn-block">Block level button</a>
    </div>

    <!-- Block button in standard bar fixed above the footer -->
    <div class="bar bar-standard bar-footer-secondary">
    <a class="btn btn-block">Block level button</a>
    </div>

    <!-- Icons in standard bar fixed to the bottom of the screen -->
    <div class="bar bar-standard bar-footer">
    <a class="icon icon-compose pull-left"></a>
    <a class="icon icon-gear pull-right"></a>
    </div>
  

Typography

Use headings and paragraphs to title and describe sections of your app. Apply or wrap elements with .content-padded to give the content space around the screen.

h1. Heading

h2. Heading

h3. Heading

h4. Heading

h5. Heading
h6. Heading

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.

<div class="content-padded">
    <h1>h1. Heading</h1>
    <h2>h2. Heading</h2>
    <h3>h3. Heading</h3>
    <h4>h4. Heading</h4>
    <h5>h5. Heading</h5>
    <h6>h6. Heading</h6>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco.</p>
    </div>
  

Table views

Table views can be used for organizing data, showing collections of links, or a series of controls.

  • Item 1
  • Item 2
  • Divider
  • Item 3
<ul class="table-view">
    <li class="table-view-cell">Item 1</li>
    <li class="table-view-cell table-view-cell">Item 2</li>
    <li class="table-view-divider">Divider</li>
    <li class="table-view-cell">Item 3</li>
    </ul>
  

Table view with chevrons

Chevrons should be used to indicate that the item is linked. Just apply the classes .push-right or .push-left to use a chevron.

<ul class="table-view">
    <li class="table-view-cell">
    <a class="push-right">
    Item 1
    </a>
    </li>
    <li class="table-view-cell">
    <a class="push-right">
    Item 2
    </a>
    </li>
    <li class="table-view-cell">
    <a class="push-right">
    Item 3
    </a>
    </li>
    </ul>
  

Table view with badges

Badges are a great way of showing data.

  • Item 1 4
  • Item 2 1
  • Item 3 5
<ul class="table-view">
    <li class="table-view-cell">Item 1 <span class="badge">4</span></li>
    <li class="table-view-cell">Item 2 <span class="badge">1</span></li>
    <li class="table-view-cell">Item 3 <span class="badge">5</span></li>
    </ul>
  

Table view with badges and chevrons

Feel free to use chevrons and badges together. They'll automatically positon themselves correctly.

<ul class="table-view">
    <li class="table-view-cell">
    <a class="push-right">
    <span class="badge">5</span>
    Item 1
    </a>
    </li>
    <li class="table-view-cell">
    <a class="push-right">
    <span class="badge">5</span>
    Item 2
    </a>
    </li>
    <li class="table-view-cell">
    <a class="push-right">
    <span class="badge">5</span>
    Item 3
    </a>
    </li>
    </ul>
  

Table view with media (images)

Showing media inside table views is easy. This component to perfect for images and text.

<ul class="table-view">
    <li class="table-view-cell media">
    <a class="push-right">
    <img class="media-object pull-left" src="http://placehold.it/42x42">
    <div class="media-body">
    Item 1
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore. Lorem ipsum dolor sit amet.</p>
    </div>
    </a>
    </li>
    <li class="table-view-cell media">
    <a class="push-right">
    <img class="media-object pull-left" src="http://placehold.it/42x42">
    <div class="media-body">
    Item 1
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore. Lorem ipsum dolor sit amet.</p>
    </div>
    </a>
    </li>
    <li class="table-view-cell media">
    <a class="push-right">
    <img class="media-object pull-left" src="http://placehold.it/42x42">
    <div class="media-body">
    Item 1
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore. Lorem ipsum dolor sit amet.</p>
    </div>
    </a>
    </li>
    </ul>
  

Table view with media (icons)

Ratchicons can also used instead of images.

<ul class="table-view">
    <li class="table-view-cell media">
    <a class="push-right">
    <span class="media-object pull-left icon icon-trash"></span>
    <div class="media-body">
    Item 1
    </div>
    </a>
    </li>
    <li class="table-view-cell media">
    <a class="push-right">
    <span class="media-object pull-left icon icon-gear"></span>
    <div class="media-body">
    Item 2
    </div>
    </a>
    </li>
    <li class="table-view-cell media">
    <a class="push-right">
    <span class="media-object pull-left icon icon-pages"></span>
    <div class="media-body">
    Item 3
    </div>
    </a>
    </li>
    </ul>
  

Table view with buttons

<ul class="table-view">
    <li class="table-view-cell">Item 1 <a class="btn">Button</a></li>
    <li class="table-view-cell">Item 2 <a class="btn btn-primary">Button</a></li>
    <li class="table-view-cell">Item 3 <a class="btn btn-positive">Button</a></li>
    <li class="table-view-cell">Item 4 <a class="btn btn-negative">Button</a></li>
    </ul>
  

Table view with toggles

  • Item 1
  • Item 2
  • Item 3
<ul class="table-view">
    <li class="table-view-cell">
    Item 1
    <div class="toggle">
    <div class="toggle-handle"></div>
    </div>
    </li>
    <li class="table-view-cell">
    Item 2
    <div class="toggle active">
    <div class="toggle-handle"></div>
    </div>
    </li>
    <li class="table-view-cell">
    Item 3
    <div class="toggle">
    <div class="toggle-handle"></div>
    </div>
    </li>
    </ul>
  

Carded table views

Use .card to wrap any content in a padded element.

  • Item 1
  • Item 2
  • Divider
  • Item 3
  • Item 4
<div class="card">
    <ul class="table-view">
    <li class="table-view-cell">Item 1</li>
    <li class="table-view-cell">Item 2</li>
    <li class="table-view-cell table-view-divider">Divider</li>
    <li class="table-view-cell">Item 3</li>
    <li class="table-view-cell">Item 4</li>
    </ul>
    </div>
  

Buttons

Buttons come in many flavors and should be used for user actions.

<a class="btn">Button</a>
    <a class="btn btn-primary">Button</a>
    <a class="btn btn-positive">Button</a>
    <a class="btn btn-negative">Button</a>
    <a class="btn btn-link">Button</a>

    <a class="btn btn-outlined">Button</a>
    <a class="btn btn-primary btn-outlined">Button</a>
    <a class="btn btn-positive btn-outlined">Button</a>
    <a class="btn btn-negative btn-outlined">Button</a>
  

Buttons with icons

Ratchicons work inside buttons too.

<a class="btn">
    <span class="icon icon-search"></span>
    Button
    </a>
    <a class="btn btn-primary">
    <span class="icon icon-search"></span>
    Button
    </a>
    <a class="btn btn-positive">
    <span class="icon icon-search"></span>
    Button
    </a>
    <a class="btn btn-negative">
    <span class="icon icon-search"></span>
    Button
    </a>
    <a class="btn btn-link">
    <span class="icon icon-left"></span>
    Button
    </a>
  

Buttons with badges

<a class="btn">Badge button <span class="badge">1</span></a>
    <a class="btn btn-primary">Badge button <span class="badge badge-primary">1</span></a>
    <a class="btn btn-positive">Badge button <span class="badge badge-positive">1</span></a>
    <a class="btn btn-negative">Badge button <span class="badge badge-negative">1</span></a>

    <a class="btn btn-outlined">Badge button <span class="badge badge-inverted">1</span></a>
    <a class="btn btn-outlined btn-primary">Badge button <span class="badge badge-primary badge-inverted">1</span></a>
    <a class="btn btn-outlined btn-positive">Badge button <span class="badge badge-positive badge-inverted">1</span></a>
    <a class="btn btn-outlined btn-negative">Badge button <span class="badge badge-negative badge-inverted">1</span></a>
  

Block buttons

<a class="btn btn-block">Block button</a>
    <a class="btn btn-primary btn-block">Block button</a>
    <a class="btn btn-positive btn-block">Block button</a>
    <a class="btn btn-negative btn-block">Block button</a>

    <a class="btn btn-block btn-outlined">Block button</a>
    <a class="btn btn-primary btn-block btn-outlined">Block button</a>
    <a class="btn btn-positive btn-block btn-outlined">Block button</a>
    <a class="btn btn-negative btn-block btn-outlined">Block button</a>
  

Segmented control

Content sections that are to be swapped in and out by the controller should all be siblings and have the class .control-content. Then, just give each content section an id and point the link in the segmented control to that id.

<div class="segmented-control">
    <a class="control-item active" href="#item1mobile">
    Thing one
    </a>
    <a class="control-item" href="#item2mobile">
    Thing two
    </a>
    <a class="control-item" href="#item3mobile">
    Thing three
    </a>
    </div>
    <div class="card">
    <span id="item1mobile" class="control-content active">Item 1</span>
    <span id="item2mobile" class="control-content">Item 2</span>
    <span id="item3mobile" class="control-content">Item 3</span>
    </div>
  

Badges

Badges come in four flavors and should be used to indicate "how many" of something there are. Adding the a class of .badge-inverted will remove the badges background color.

1 2 3 4 1 2 3 4
<span class="badge">1</span>
    <span class="badge badge-primary">2</span>
    <span class="badge badge-positive">3</span>
    <span class="badge badge-negative">4</span>

    <span class="badge badge-inverted">1</span>
    <span class="badge badge-primary badge-inverted">2</span>
    <span class="badge badge-positive badge-inverted">3</span>
    <span class="badge badge-negative badge-inverted">4</span>
  

Forms

<form>
    <input type="text" placeholder="Full name">
    <input type="search" placeholder="Search">
    <textarea rows="5"></textarea>
    <a class="btn btn-positive btn-block">Choose existing</a>
    </form>
  

Form with input group

<form class="input-group">
    <input type="text" placeholder="Full name">
    <input type="email" placeholder="Email">
    <input type="text" placeholder="Username">
    </form>
  

Form with input group and labels

<form class="input-group">
    <div class="input-row">
    <label>Full name</label>
    <input type="text" placeholder="Mister Ratchet">
    </div>
    <div class="input-row">
    <label>Email</label>
    <input type="email" placeholder="ratchetframework@gmail.com">
    </div>
    <div class="input-row">
    <label>Username</label>
    <input type="text" placeholder="goRatchet">
    </div>
    </form>
  

Toggles

Toggles can be used by sliding or tapping the control.

<div class="toggle active">
    <div class="toggle-handle"></div>
    </div>
    <div class="toggle">
    <div class="toggle-handle"></div>
    </div>
  

Toggles.js binds an event to the document that returns a detail object and can be used to fire a callback.

// Only needed if you want to fire a callback
    document
    .querySelector('#myToggle')
    .addEventListener('toggle', myFunction)
  

Popovers

<div id="popover" class="popover">
    <header class="bar bar-nav">
    <h1 class="title">Popover title</h1>
    </header>
    <ul class="table-view">
    <li class="table-view-cell">Item1</li>
    <li class="table-view-cell">Item2</li>
    <li class="table-view-cell">Item3</li>
    <li class="table-view-cell">Item4</li>
    <li class="table-view-cell">Item5</li>
    <li class="table-view-cell">Item6</li>
    <li class="table-view-cell">Item7</li>
    <li class="table-view-cell">Item8</li>
    </ul>
    </div>
  

Popovers are designed to only fire from title bars. Set the value of the title href to the id of a popover, like so:

<header class="bar bar-nav">
    <a href="#myPopover">
    <h1 class="title">
    Tap title
    <span class="icon icon-caret"></span>
    </h1>
    </a>
    </header>
  

Modals

Open modal
<a href="#myModalexample" class="btn">Open modal</a>
    <div id="myModalexample" class="modal">
    <header class="bar bar-nav">
    <a class="icon icon-close pull-right" href="#myModalexample"></a>
    <h1 class="title">Modal</h1>
    </header>

    <div class="content">
    <p class="content-padded">The contents of my modal go here. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut.</p>
    </div>
    </div>
  

Modals are designed to only fire from links. Set the value of the toggle links href to the id of a modal.

Sliders

Can be used with any number of slides with any type of content.

Slide me
<div class="slider" id="mySlider">
    <div class="slide-group">
    <div class="slide">
    <img src="node_modules/ratchet/docs/assets/img/slide-1.png">
    <span class="slide-text">
    <span class="icon icon-left-nav"></span>
    Slide me
    </span>
    </div>
    <div class="slide">
    <img src="node_modules/ratchet/docs/assets/img/slide-2.png">
    </div>
    <div class="slide">
    <img src="node_modules/ratchet/docs/assets/img/slide-3.png">
    </div>
    </div>
    </div>
  

Sliders.js binds an event to the document that returns a detail object and can be used to fire a callback.

// Only needed if you want to fire a callback
    document
    .querySelector('#mySlider')
    .addEventListener('slide', myFunction)
  

Push

Push.js is the engine that connects Ratchet pages together with AJAX and the history api. Push.js is listening to all clicks on a page, so just make sure it's included and link something in your Ratchet project up.

<!-- A one.html link -->
    <a href="two.html">Two</a>
  

This will use push to replace everything in the .content div with the .content of two.html. Also, it will either update or remove .bar-nav and .bar-tab according to their presences in two.html.

Now that pages are being loaded through push, it's easy to specify transitions for animations between pages. There are three different transitions to chose from: fade, slide-in, or slide-out.

<!-- An one.html link that animates to two.html -->
    <a href="two.html" data-transition="fade">Two</a>
  

A working version of push:

<header class="bar bar-nav">
    <h1 class="title">Push</h1>
    </header>
    <div class="content">
    <div class="card">
    <ul class="table-view">
    <li class="table-view-cell">
    <a class="push-right" href="../two.html" data-transition="slide-in">
    Load new page with push
    </a>
    </li>
    </ul>
    </div>
    </div>
  

Have a link you don't want to intercepted by push? Try this:

<!-- Use data-ignore="push" to prevent the push.js interception -->
    <a href="http://www.google.com" data-ignore="push">Google<a>
  

Push.js binds an event to the document that returns a detail object and can be used to fire a callback.

// Only needed if you want to fire a callback
    window.addEventListener('push', myFunction);
  

Ratchicons

Use Ratchicons in your application to help inform interactions.

<div class="content-padded">
    <span class="icon icon-home"></span>
    <span class="icon icon-person"></span>
    <span class="icon icon-bars"></span>
    <span class="icon icon-caret"></span>
    <span class="icon icon-check"></span>
    <span class="icon icon-close"></span>
    <span class="icon icon-code"></span>
    <span class="icon icon-compose"></span>
    <span class="icon icon-edit"></span>
    <span class="icon icon-gear"></span>
    <span class="icon icon-info"></span>
    <span class="icon icon-list"></span>
    <span class="icon icon-more"></span>
    <span class="icon icon-more-vertical"></span>
    <span class="icon icon-pages"></span>
    <span class="icon icon-play"></span>
    <span class="icon icon-pause"></span>
    <span class="icon icon-stop"></span>
    <span class="icon icon-back"></span>
    <span class="icon icon-forward"></span>
    <span class="icon icon-plus"></span>
    <span class="icon icon-refresh"></span>
    <span class="icon icon-search"></span>
    <span class="icon icon-download"></span>
    <span class="icon icon-share"></span>
    <span class="icon icon-sound"></span>
    <span class="icon icon-sound2"></span>
    <span class="icon icon-sound3"></span>
    <span class="icon icon-sound4"></span>
    <span class="icon icon-star-filled"></span>
    <span class="icon icon-star"></span>
    <span class="icon icon-trash"></span>
    <span class="icon icon-down-nav"></span>
    <span class="icon icon-down"></span>
    <span class="icon icon-left-nav"></span>
    <span class="icon icon-left"></span>
    <span class="icon icon-right-nav"></span>
    <span class="icon icon-right"></span>
    <span class="icon icon-up-nav"></span>
    <span class="icon icon-up"></span>
    </div>