Framework v4 BETA

Structure

Ionic Framework provides several different layouts that can be used to structure an app. From single page layouts, to split pane views and modals.

The most simple layout available consists of a header and content. Most pages in an app generally have both of these, but a header is not required in order to use content.

markup preview
html
<ion-app>
  <ion-header>
    <ion-toolbar>
      <ion-title>Header</ion-title>
    </ion-toolbar>
  </ion-header>

  <ion-content padding>
    <h1>Main Content</h1>
  </ion-content>
</ion-app>
Header

Main Content

As you can see, a toolbar in a header appears above the content. Sometimes an app needs to have a toolbar below the content, which is when a footer is used.

markup preview
html
<ion-app>
  <ion-content padding>
    <h1>Main Content</h1>
  </ion-content>

  <ion-footer>
    <ion-toolbar>
      <ion-title>Footer</ion-title>
    </ion-toolbar>
  </ion-footer>
</ion-app>

Main Content

Footer

These can also be combined on one page to have a toolbar above and below the content.

markup preview
html
<ion-app>
  <ion-header>
    <ion-toolbar>
      <ion-title>Header</ion-title>
    </ion-toolbar>
  </ion-header>

  <ion-content padding>
    <h1>Main Content</h1>
  </ion-content>

  <ion-footer>
    <ion-toolbar>
      <ion-title>Footer</ion-title>
    </ion-toolbar>
  </ion-footer>
</ion-app>
Header

Main Content

Footer

Tabs Layout

A layout consisting of horizontal tabs can be used to let the user quickly change between content views. Each tab can contain static content or a navigation stack by using an ion-router-outlet or ion-nav.

markup preview
html
<ion-app>
  <ion-tabs>
    <ion-tab label="Home" icon="home">
      <ion-header>
        <ion-toolbar>
          <ion-title>Home</ion-title>
        </ion-toolbar>
      </ion-header>
      <ion-content padding>
        <h1>Home Content</h1>
      </ion-content>
    </ion-tab>

    <ion-tab label="Map" icon="map">
      <ion-header>
        <ion-toolbar>
          <ion-title>Map</ion-title>
        </ion-toolbar>
      </ion-header>
      <ion-content padding>
        <h1>Map Content</h1>
      </ion-content>
    </ion-tab>

    <ion-tab label="Camera" icon="camera">
      <ion-header>
        <ion-toolbar>
          <ion-title>Camera</ion-title>
        </ion-toolbar>
      </ion-header>
      <ion-content padding>
        <h1>Camera Content</h1>
      </ion-content>
    </ion-tab>
  </ion-tabs>
</ion-app>
Home

Home Content

Map

Map Content

Camera

Camera Content

A standard layout among mobile apps includes the ability to toggle a side menu by clicking a button or swiping it open from the side. Side menus are generally used for navigation, but they can contain any content.

markup preview
html
<ion-app>
  <ion-menu>
    <ion-header>
      <ion-toolbar color="primary">
        <ion-title>Menu</ion-title>
      </ion-toolbar>
    </ion-header>

    <ion-content>
      <ion-list>
        <ion-list-header>
          Navigate
        </ion-list-header>
        <ion-menu-toggle auto-hide="false">
          <ion-item button>
            <ion-icon slot="start" name='home'></ion-icon>
            <ion-label>
              Home
            </ion-label>
          </ion-item>
        </ion-menu-toggle>
      </ion-list>
    </ion-content>
  </ion-menu>

  <ion-page class="ion-page" main>
    <ion-header>
      <ion-toolbar>
        <ion-buttons slot="start">
          <ion-menu-toggle>
            <ion-button>
              <ion-icon slot="icon-only" name="menu"></ion-icon>
            </ion-button>
          </ion-menu-toggle>
        </ion-buttons>
        <ion-title>Header</ion-title>
      </ion-toolbar>
    </ion-header>
    <ion-content padding>
      <h1>Main Content</h1>
      <p>Click the icon in the top left to toggle the menu.</p>
    </ion-content>
  </ion-page>
</ion-app>

<ion-menu-controller></ion-menu-controller>
Menu Navigate Home Header

Main Content

Click the icon in the top left to toggle the menu.

Split Pane Layout

A split pane layout has a more complex structure because it can combine the previous layouts. It allows for multiple views to be displayed when the viewport is above a specified breakpoint. If the device's screen size is below a certain size, the split pane view will be hidden.

By default, the split pane view will show when the screen is larger than 768px, or the md breakpoint, but this can be customized to use different breakpoints by setting the when property. Below is an example where the split pane contains a menu that is visible for sm screens and up, or when the viewport is larger than 576px. By resizing the browser horizontally so that the app is smaller than this, the split pane view will disappear.

markup preview
html
<ion-app>
  <ion-split-pane when="sm">
    <ion-menu>
      <ion-header>
        <ion-toolbar color="primary">
          <ion-title>Menu</ion-title>
        </ion-toolbar>
      </ion-header>

      <ion-content>
        <ion-list>
          <ion-list-header>
            Navigate
          </ion-list-header>
          <ion-menu-toggle auto-hide="false">
            <ion-item button>
              <ion-icon slot="start" name='home'></ion-icon>
              <ion-label>
                Home
              </ion-label>
            </ion-item>
          </ion-menu-toggle>
        </ion-list>
      </ion-content>
    </ion-menu>

    <ion-page class="ion-page" main>
      <ion-header>
        <ion-toolbar>
          <ion-buttons slot="start">
            <ion-menu-toggle>
              <ion-button>
                <ion-icon slot="icon-only" name="menu"></ion-icon>
              </ion-button>
            </ion-menu-toggle>
          </ion-buttons>
          <ion-title>Header</ion-title>
        </ion-toolbar>
      </ion-header>
      <ion-content padding>
        <h1>Main Content</h1>
      </ion-content>
    </ion-page>

  </ion-split-pane>
</ion-app>
Menu Navigate Home Header

Main Content

It's important to note that the element with the main attribute will be the main content that is always visible. This can be any element, including an ion-nav, ion-router-outlet, or an ion-tabs.