Installation

It is really easy to build your app with Framework7. To get started we need to install Framework7. You can skip this step and use one of the ready to use starter app templates.

We can download/install framework7 with two ways:

  • Download From GitHub Repository

    We can download required Framework7 files from Framework7 GitHub repository.

  • Install From NPM

    We can also install Framework7 from NPM:

    1. $ npm install framework7

From the downloaded Core package we will need files from css and js folders

ES Module

This feature currently can be used in bundlers like Webpack and Rollup

Framework7 can also be imported as an ES-next module:

  1. import Framework7 from 'framework7';

Framework7 has modular structure and by default it exports only core Framework7 with core components.

And if you need additional components they must be included additionally:

  1. // Import core framework
  2. import Framework7 from 'framework7';
  3. // Import additional components
  4. import Searchbar from 'framework7/components/searchbar/searchbar.js';
  5. import Calendar from 'framework7/components/calendar/calendar.js';
  6. import Popup from 'framework7/components/popup/popup.js';
  7. // Install F7 Components using .use() method on class:
  8. Framework7.use([Searchbar, Calendar, Popup]);
  9. // Init app
  10. var app = new Framework7({/*...*/});

Such modular structure provides best tree-shaking results and package size optimization.

In addition to default export it has named export for Template7, Dom7, Request, Device, Utils and Support libraries:

  1. import Framework7, { Device, Request } from 'framework7';
  2. var app = new Framework7({/*...*/});
  3. if (Device.ios) {
  4. Request.get('http://google.com');
  5. }

ES Module Bundle

If you need to include Framework7 with all components, we can include its another script bundle with all components installed:

  1. // Import framework with all components
  2. import Framework7 from 'framework7/framework7.esm.bundle.js';
  3. // Init app
  4. var app = new Framework7({/*...*/});

ES-Next

Note, that Framework7 ES modules are in ES-next syntax, so don’t forget to enable/configure your Babel/Buble to transpile them as well, as well as template7, dom7 and ssr-window modules that used as dependencies.

App HTML Layout

Now when we have downloaded/installed Framework7, we can start from creating App Layout.