Capacitor can be installed directly into any new or existing Ionic app.
Capacitor is installed in new Ionic apps by default! All you have to do is start a new project:
ionic start
If you’d like a tutorial for building your first Ionic/Capacitor app, see this tutorial.
Install and initialize Capacitor with your app name and bundle ID:
ionic integrations enable capacitor
Ionic Framework makes use of the APIs in the following plugins:
For the best user experience, you should make sure these plugins are installed even if you don’t import them in your app:
npm install @capacitor/app @capacitor/haptics @capacitor/keyboard @capacitor/status-bar
If your Ionic app uses Cordova, you will want to read the Migrating from Cordova to Capacitor guide as well.
After Capacitor installed, you can add native platforms to your app:
ionic capacitor add
This will create a new directory in the root of your project for the native platform. This directory is a native project that should be considered a source artifact. Learn more about native project management.
Capacitor JavaScript libraries are bundled into your app, so the web asset build is no different after Capacitor is installed.
ionic build
This creates the web asset directory that Capacitor copies into native projects, configured via
webDir
in the Capacitor configuration.
The Ionic CLI has a variety of high-level commands that wrap the Capacitor CLI for convenience. See the documentation for each below. Help output is also available by using the
--help
flag after each command.
ionic capacitor add
ionic capacitor build
ionic capacitor run
ionic capacitor sync
ionic capacitor open
Learn more about development workflow in Capacitor ›