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

Header

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.

  1. <ion-app>
  2. <ion-header>
  3. <ion-toolbar>
  4. <ion-title>Header</ion-title>
  5. </ion-toolbar>
  6. </ion-header>
  7. <ion-content padding>
  8. <h1>Main Content</h1>
  9. </ion-content>
  10. </ion-app>

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.

  1. <ion-app>
  2. <ion-content padding>
  3. <h1>Main Content</h1>
  4. </ion-content>
  5. <ion-footer>
  6. <ion-toolbar>
  7. <ion-title>Footer</ion-title>
  8. </ion-toolbar>
  9. </ion-footer>
  10. </ion-app>

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

  1. <ion-app>
  2. <ion-header>
  3. <ion-toolbar>
  4. <ion-title>Header</ion-title>
  5. </ion-toolbar>
  6. </ion-header>
  7. <ion-content padding>
  8. <h1>Main Content</h1>
  9. </ion-content>
  10. <ion-footer>
  11. <ion-toolbar>
  12. <ion-title>Footer</ion-title>
  13. </ion-toolbar>
  14. </ion-footer>
  15. </ion-app>

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.

  1. <ion-app>
  2. <ion-tabs>
  3. <ion-tab tab="home">
  4. <h1>Home Content</h1>
  5. </ion-tab>
  6. <ion-tab tab="settings">
  7. <h1>Settings Content</h1>
  8. </ion-tab>
  9. <ion-tab-bar slot="bottom">
  10. <ion-tab-button tab="home">
  11. <ion-label>Home</ion-label>
  12. <ion-icon name="home"></ion-icon>
  13. </ion-tab-button>
  14. <ion-tab-button tab="settings">
  15. <ion-label>Settings</ion-label>
  16. <ion-icon name="settings"></ion-icon>
  17. </ion-tab-button>
  18. </ion-tab-bar>
  19. </ion-tabs>
  20. </ion-app>

Menu Layout

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.

  1. <ion-app>
  2. <ion-menu>
  3. <ion-header>
  4. <ion-toolbar color="primary">
  5. <ion-title>Menu</ion-title>
  6. </ion-toolbar>
  7. </ion-header>
  8. <ion-content>
  9. <ion-list>
  10. <ion-list-header>
  11. Navigate
  12. </ion-list-header>
  13. <ion-menu-toggle auto-hide="false">
  14. <ion-item button>
  15. <ion-icon slot="start" name='home'></ion-icon>
  16. <ion-label>
  17. Home
  18. </ion-label>
  19. </ion-item>
  20. </ion-menu-toggle>
  21. </ion-list>
  22. </ion-content>
  23. </ion-menu>
  24. <ion-page class="ion-page" main>
  25. <ion-header>
  26. <ion-toolbar>
  27. <ion-buttons slot="start">
  28. <ion-menu-toggle>
  29. <ion-button>
  30. <ion-icon slot="icon-only" name="menu"></ion-icon>
  31. </ion-button>
  32. </ion-menu-toggle>
  33. </ion-buttons>
  34. <ion-title>Header</ion-title>
  35. </ion-toolbar>
  36. </ion-header>
  37. <ion-content padding>
  38. <h1>Main Content</h1>
  39. <p>Click the icon in the top left to toggle the menu.</p>
  40. </ion-content>
  41. </ion-page>
  42. </ion-app>
  43. <ion-menu-controller></ion-menu-controller>

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.

  1. <ion-app>
  2. <ion-split-pane when="sm">
  3. <ion-menu>
  4. <ion-header>
  5. <ion-toolbar color="primary">
  6. <ion-title>Menu</ion-title>
  7. </ion-toolbar>
  8. </ion-header>
  9. <ion-content>
  10. <ion-list>
  11. <ion-list-header>
  12. Navigate
  13. </ion-list-header>
  14. <ion-menu-toggle auto-hide="false">
  15. <ion-item button>
  16. <ion-icon slot="start" name='home'></ion-icon>
  17. <ion-label>
  18. Home
  19. </ion-label>
  20. </ion-item>
  21. </ion-menu-toggle>
  22. </ion-list>
  23. </ion-content>
  24. </ion-menu>
  25. <ion-page class="ion-page" main>
  26. <ion-header>
  27. <ion-toolbar>
  28. <ion-buttons slot="start">
  29. <ion-menu-toggle>
  30. <ion-button>
  31. <ion-icon slot="icon-only" name="menu"></ion-icon>
  32. </ion-button>
  33. </ion-menu-toggle>
  34. </ion-buttons>
  35. <ion-title>Header</ion-title>
  36. </ion-toolbar>
  37. </ion-header>
  38. <ion-content padding>
  39. <h1>Main Content</h1>
  40. </ion-content>
  41. </ion-page>
  42. </ion-split-pane>
  43. </ion-app>


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.