Framework7 Vue
framework7-vue is an integration package that bridges the powerful mobile UI components of Framework7 with the reactive capabilities of Vue.js, enabling developers to build full-featured iOS and Android applications. The package is currently at version 9.0.3, released recently with bug fixes for calendar and modal components. Framework7 itself is known for providing native-like UI/UX for both iOS and Material Design themes, and this package wraps those components for seamless use within Vue applications. It maintains a frequent release cadence, primarily focusing on bug fixes and incremental improvements in minor versions, while major versions (like v9.0.0) introduce significant UI/UX overhauls to align with latest platform designs (e.g., iOS 26 styles, Material You) and may include breaking API changes. Its key differentiators include its comprehensive set of pre-built UI components, dedicated themes for iOS and Material Design, and its ability to be used with Cordova or Capacitor for native app packaging.
Common errors
-
Failed to resolve component: f7-app
cause The Framework7 Vue plugin (`Framework7Vue`) was not correctly installed or registered with the Vue application.fixEnsure you have `import Framework7 from 'framework7/lite-bundle'; import Framework7Vue from 'framework7-vue'; Framework7.use(Framework7Vue);` (or `app.use(Framework7Vue)`) in your application's entry file before mounting the Vue app. -
TypeError: Cannot read properties of undefined (reading 'dialog') (or similar error when accessing `this.$f7` or `f7`)
cause Attempting to access the Framework7 instance (`this.$f7` or the `f7` export) before Framework7 has fully initialized or before it's available within the component context.fixUse the `f7ready` utility function or the `this.$f7ready()` component method to ensure Framework7 is initialized before interacting with its APIs. For example, `this.$f7ready((f7Instance) => { f7Instance.dialog.alert('Hello!'); });`. -
TS2307: Cannot find module 'framework7/framework7-bundle.min.css' or its corresponding type declarations.
cause TypeScript is unable to resolve the imported CSS module, often because there's no declaration file for `.css` imports or the `framework7` types are missing.fixEnsure you have installed `@types/framework7` (`npm install -D @types/framework7`) and that your `tsconfig.json` includes `"allowSyntheticDefaultImports": true` and a `css.d.ts` file or similar declaration to handle CSS module imports (e.g., `declare module '*.css';`).
Warnings
- breaking The `dynamicNavbar` functionality has been completely removed from Navbar components.
- breaking The default 'Back' link text in navbars has been changed to an icon-only approach, removing the explicit 'Back' text by default.
- gotcha Framework7 CSS/theme files must be imported separately from the `framework7` package, not `framework7-vue`.
Install
-
npm install framework7-vue -
yarn add framework7-vue -
pnpm add framework7-vue
Imports
- Framework7Vue
import { Framework7Vue } from 'framework7-vue';import Framework7Vue from 'framework7-vue';
- f7
import Framework7 from 'framework7-vue'; const f7Instance = Framework7.instance;
import { f7 } from 'framework7-vue'; - f7ready
import { f7ready } from 'framework7-vue'; - Framework7 core CSS
import 'framework7-vue/dist/framework7-vue.min.css';
import 'framework7/framework7-bundle.min.css';
Quickstart
import { createApp } from 'vue';
import Framework7 from 'framework7/lite-bundle'; // Import Framework7 core JS
import Framework7Vue from 'framework7-vue'; // Import Framework7 Vue plugin
import 'framework7/framework7-bundle.min.css'; // Import Framework7 styles (includes all themes)
// Initialize Framework7 Vue plugin
Framework7.use(Framework7Vue);
const App = {
template: `
<f7-app :params="f7params">
<f7-view main url="/"></f7-view>
</f7-app>
`,
data() {
return {
f7params: {
name: 'My F7 App',
theme: 'auto', // Detect iOS or Material theme automatically
routes: [
{
path: '/',
component: {
template: `
<f7-page>
<f7-navbar title="Welcome" back-link="Back"></f7-navbar>
<f7-block strong>
<p>This is a simple Framework7 Vue application.</p>
<f7-button fill @click="openAlert">Show Alert</f7-button>
</f7-block>
</f7-page>
`,
methods: {
openAlert() {
this.$f7.dialog.alert('Hello from Framework7!');
}
}
}
}
]
}
};
},
mounted() {
this.$f7ready((f7) => {
console.log('Framework7 is ready!', f7);
// You can now safely use f7 APIs here, e.g., f7.dialog.alert('App mounted!');
});
}
};
const app = createApp(App);
app.mount('#app');