Title bar
Title bars are full width and docked to the top of the viewport.
--- layout: default ---
Use these docs as a reference for all the available components and piece together the pages of your app. Customize the style too - make the prototype all your own.
Read about push.js then start connecting your pages. Push.js allows you to create a prototype that feels like a real app when you save it to your phone. (Need to have a server running).
There are a few ways to do this, but the simplest is to run a local server on your computer, point Safari on your iPhone to your computer, then click the button and "Add to Home Screen".
Design patterns that serve as basic building blocks.
Title bars are full width and docked to the top of the viewport.
Buttons in a title bar are left or right aligned and should be used for actions.
{% highlight html %}Directional buttons in a title bar should be used for navigational purposes.
{% highlight html %}Title bars can also house segmented controllers (with or without accompanying buttons). It all uses flex-box to create perfectly even spacing no matter their labels.
{% highlight html %}Use Ratchicons in the tab bar to represent different sections of your app.
Note: Use push.js to actually change content.
Standard bars are basic fixed elements that can be positioned in 3 places. These can be used to house buttons or segmented controllers (see following examples).
Table views can be used for organizing data, showing collections of links or a series of controls.
Chevrons are created with CSS3, so no image assets are needed. They should be used to indicate that the item is linked.
{% highlight html %} {% endhighlight %}Buttons come in four flavors and should be used for user actions.
{% highlight html %} Button Button Button Button {% endhighlight %}Created with flex-box so button sizes and spacing are consistent. Content sections that are to be swapped in and out by the controller should all be siblings and have the class "segmented-controller-item". Then, just give each content section an id and point the link in the segmented controller to that id.
Counts come in four flavors and should be used to indicate "how many" of something there are.
Toggles can be used by sliding or tapping the control.
Toggles.js binds an event to the document that returns a detail object and can be used to fire a callback.
{% highlight js %} // Only needed if you want to fire a callback document .querySelector('#myToggle') .addEventListener('toggle', myFunction) {% endhighlight %}Popovers are designed to only fire from title bars. Set the value of the title href to the id of a popover, like so:
{% highlight html %}The contents of my modal
The contents of my modal
Modals are designed to only fire from links. Set the value of the toggle links href to the id of a modal.
Can be used with any number of slides with any type of content.
Sliders.js binds an event to the document that returns a detail object and can be used to fire a callback.
{% highlight js %} // Only needed if you want to fire a callback document .querySelector('#mySlider') .addEventListener('slide', myFunction) {% endhighlight %}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.
{% highlight html %} Two {% endhighlight %}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
.
A working version of push:
{% highlight html %}Have a link you don't want to intercepted by push? Try this:
{% highlight html %} Google {% endhighlight %}Push.js binds an event to the document that returns a detail object and can be used to fire a callback.
{% highlight js %} // Only needed if you want to fire a callback window.addEventListener('push', myFunction); {% endhighlight %}3 simple rules for structuring your Ratchet pages
All fixed bars (.bar-nav, .bar-tab, .bar-header-secondary, .bar-footer
) should always be the first thing in the <body>
of the page. This is really important!
.content
Anything that's not a .bar-
should be put in a div with the class "content
". Put this div after the bars in the <body>
tag. The .content
div is what actually scrolls in a Ratchet prototype.
They're included in the template.html page included in the download, but make sure they stay in the page. They are important to Ratchet working just right.