Ionic Expert
Comprehensive reference for Ionic Framework development — core concepts, components, theming, lifecycle, navigation, framework-specific patterns (Angular, React, Vue), upgrading, and Capawesome Cloud integration.
Core Concepts
Ionic Framework is a UI toolkit for building cross-platform apps with web technologies. It provides 80+ pre-built UI components as Web Components prefixed with
(e.g.,
,
).
- Platform modes: Components adapt styling to the platform. iOS devices use mode; Android and all other platforms use (Material Design). The element receives a class ( or ).
- Capacitor integration: Ionic handles the UI; Capacitor handles native device APIs. See the
capacitor-app-development
skill for Capacitor guidance.
- Framework support: Ionic integrates with Angular (), React (), and Vue ().
Creating a New App
bash
npm install -g @ionic/cli
ionic start <name> <template> --type=<framework> --capacitor --package-id=<id>
| value | Framework |
|---|
| Angular (NgModules) |
| Angular (Standalone Components) |
| React |
| Vue |
| Template | Description |
|---|
| Empty project, single page |
| Tab-based layout |
| Side menu layout |
For details, see
ionic-app-creation.
Ionic CLI
Run
for the full and always up-to-date command list.
| Command | Description |
|---|
| Scaffold a new Ionic project. |
| Start a local dev server with live reload (port 8100). |
| Build the web app for production. |
| Generate pages, components, services (framework-dependent). |
| Print system/environment info. |
| Remove and recreate dependencies and platform files. |
Useful
flags:
(all network interfaces),
,
,
.
Components Overview
Ionic provides 80+ UI components organized by category. For full API reference (properties, events, methods, slots, CSS custom properties), see the linked reference files.
Layout
(root container),
(scrollable area),
,
,
,
,
,
,
/
/
,
.
Key usage:
html
<ion-header>
<ion-toolbar>
<ion-buttons slot="start">
<ion-back-button defaultHref="/home"></ion-back-button>
</ion-buttons>
<ion-title>Page Title</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<!-- Scrollable content -->
</ion-content>
Navigation
Form
,
,
/
,
,
,
/
,
,
/
,
,
/
,
.
Key properties shared by most form components:
,
(
,
,
,
),
(
,
),
,
,
,
,
.
Key events:
- — fires on each keystroke (use for /).
- — fires when value is committed (use for , , , ).
html
<ion-input label="Email" labelPlacement="floating" fill="outline"
type="email" placeholder="you@example.com"
errorText="Invalid email" helperText="Enter your email">
</ion-input>
<ion-select label="Country" labelPlacement="floating" fill="outline" interface="popover">
<ion-select-option value="us">United States</ion-select-option>
<ion-select-option value="de">Germany</ion-select-option>
</ion-select>
For details, see
components-form.md.
Overlays
All overlays share:
prop for declarative control,
prop to open from a button ID,
,
, and lifecycle events (
,
,
,
).
Sheet modal (bottom sheet):
html
<ion-modal [isOpen]="isOpen" [breakpoints]="[0, 0.5, 1]" [initialBreakpoint]="0.5" [handle]="true">
<ion-content>Sheet content</ion-content>
</ion-modal>
Data Display
Scroll
/
(pull-to-refresh),
/
ion-infinite-scroll-content
,
/
.
Actions & Media
Theming
Colors
Nine default colors:
,
,
,
,
,
,
,
,
. Apply via the
attribute:
html
<ion-button color="primary">Save</ion-button>
<ion-button color="danger">Delete</ion-button>
Customize a color by overriding all six CSS variables in
:
css
:root {
--ion-color-primary: #3880ff;
--ion-color-primary-rgb: 56, 128, 255;
--ion-color-primary-contrast: #ffffff;
--ion-color-primary-contrast-rgb: 255, 255, 255;
--ion-color-primary-shade: #3171e0;
--ion-color-primary-tint: #4c8dff;
}
Global CSS Variables
Key variables:
,
,
,
--ion-safe-area-top/right/bottom/left
,
,
.
Dark Mode
Three approaches (import from
,
, or
):
- System preference (default):
@import '@ionic/<framework>/css/palettes/dark.system.css';
- Always dark:
@import '@ionic/<framework>/css/palettes/dark.always.css';
- CSS class toggle:
@import '@ionic/<framework>/css/palettes/dark.class.css';
then add to .
Platform Styles
Target platform-specific styles in CSS using the mode class on
:
css
.ios ion-toolbar { --background: #f8f8f8; }
.md ion-toolbar { --background: #ffffff; }
Preview a specific mode in the browser:
http://localhost:8100/?ionic:mode=ios
Layout
Grid System
12-column flexbox grid:
,
,
. Columns expand evenly unless
(1-12) is specified.
| Breakpoint | Min Width | Property Suffix |
|---|
| 0 | |
| 576px | |
| 768px | |
| 992px | |
| 1200px | |
CSS Utility Classes
- Padding: ,
.ion-padding-top/bottom/start/end
,
- Margin: ,
.ion-margin-top/bottom/start/end
,
- Text: , , , ,
- Display: , ,
- Flex:
.ion-justify-content-center
, , ,
All utility classes support responsive suffixes:
(applies at 768px+).
Page Lifecycle
Ionic provides four lifecycle hooks that fire during page transitions. These exist because
caches pages in the DOM — framework-native lifecycle hooks (
,
,
) only fire once on first creation, not on every page visit.
| Hook | Fires When | Use For |
|---|
| Page about to enter (pre-animation) | Refresh data on every visit |
| Page fully entered (post-animation) | Start animations, focus inputs |
| Page about to leave (pre-animation) | Save state, pause subscriptions |
| Page fully left (post-animation) | Clean up off-screen resources |
Critical rules:
- Only fire on components directly mapped to a route via .
- Child components do not receive these events.
- The component must use the framework-specific page wrapper (see framework sections below).
Framework-Specific Patterns
Angular
For full details, see
ionic-angular.
Detect architecture: Check
for
(standalone) vs
platformBrowserDynamic().bootstrapModule
(NgModule).
| Aspect | Standalone | NgModule |
|---|
| Ionic setup | in | in |
| Component imports | Each from @ionic/angular/standalone
| provides all globally |
| Lazy loading | in routes | in routes |
| Icons | from required | Automatic |
Navigation: Use
from
for animated navigation (
,
,
,
). Use
with
in templates.
Lifecycle: Implement interfaces
,
,
,
from
:
typescript
import { ViewWillEnter } from '@ionic/angular';
@Component({ /* ... */ })
export class HomePage implements ViewWillEnter {
ionViewWillEnter() {
this.loadData(); // Runs on every page visit
}
}
For navigation details, see
angular/navigation.md. For lifecycle details, see
angular/lifecycle.md.
React
For full details, see
ionic-react.
Key setup differences:
- Call before rendering in .
- Use (from ) instead of .
- Use to contain routes with the prop (not or ).
- Every page must render as root — required for transitions and lifecycle hooks.
Navigation: Use
hook for programmatic navigation:
typescript
import { useIonRouter } from '@ionic/react';
const router = useIonRouter();
router.push('/detail/123', 'forward', 'push');
router.goBack();
typescript
import { useIonViewWillEnter } from '@ionic/react';
useIonViewWillEnter(() => {
fetchData(); // Runs on every page visit
});
Overlay hooks:
,
,
,
,
,
,
.
Form events: Use
for
/
,
for
/
/
/
. Access values via
.
For routing details, see
react/routing.md. For hooks, see
react/hooks.md.
Vue
For full details, see
ionic-vue.
Key setup differences:
- Install plugin in :
createApp(App).use(IonicVue).use(router)
.
- Import from (not from ).
- Every page must use as root template element — without it, transitions and lifecycle hooks silently fail.
- Import all Ionic components from .
- Use kebab-case for event names in templates (, ).
- Import icons as SVG references from — never as strings.
Navigation: Use
composable:
vue
<script setup lang="ts">
import { useIonRouter } from '@ionic/vue';
const ionRouter = useIonRouter();
ionRouter.push('/detail/123');
ionRouter.back();
</script>
Declarative:
<ion-button router-link="/detail" router-direction="forward">Go</ion-button>
vue
<script setup lang="ts">
import { onIonViewWillEnter } from '@ionic/vue';
onIonViewWillEnter(() => {
fetchData(); // Runs on every page visit
});
</script>
Composables:
,
useBackButton(priority, handler)
,
,
,
.
Access Web Component methods via :
contentRef.value.$el.scrollToBottom(300)
.
For navigation details, see
vue/navigation.md. For composables, see
vue/composables.md.
Navigation Patterns
Tab Navigation
Each framework uses
with
and child routes per tab. Each tab maintains its own navigation stack.
Rules:
- The attribute on must match the child route path.
- Never navigate between tabs programmatically — only the tab bar buttons should switch tabs.
- For shared views across tabs, use instead of cross-tab routing.
Side Menu
Use
with
matching the
on
. Wrap menu items in
to auto-close after selection. Use
for top-level menu navigation.
Linear vs. Non-Linear Routing
- Linear: Sequential forward/back navigation (list -> detail -> edit). Back button returns to the previous page.
- Non-linear: Multiple independent stacks (tabs). Back navigation stays within the current tab's stack.
Use non-linear routing for tabs or split-pane layouts. Use linear routing for simple page flows.
Upgrading
Ionic supports upgrades from version 4 through 8. Each major version jump must be applied sequentially — do not skip intermediate versions.
For full upgrade guides, see
ionic-app-upgrades.
Capacitor Integration
Ionic apps use Capacitor for native device features (camera, filesystem, push notifications, etc.). The standard workflow:
bash
npm run build
npx cap sync
npx cap run android
npx cap run ios
For live reload on a device:
bash
ionic cap run android --livereload --external
ionic cap run ios --livereload --external
For Capacitor guidance, see the
capacitor-app-development
skill.
Capawesome Cloud
Capawesome Cloud provides CI/CD services for Ionic/Capacitor apps:
- Live Updates — Deploy OTA updates to Ionic/Capacitor apps instantly, without app store review.
- Native Builds — Build iOS and Android binaries in the cloud without local Xcode or Android Studio.
- App Store Publishing — Automate submissions to the Apple App Store and Google Play Store.
Visit
capawesome.io for the full Capawesome ecosystem. For setup, see the
skill.
Common Troubleshooting
- : Run
npm install -g @ionic/cli
.
- Components not rendering: Verify Ionic CSS files are imported in the global stylesheet. For standalone Angular, verify each component is imported from
@ionic/angular/standalone
.
- not firing: The component must be directly routed via . Child components do not receive lifecycle events. For React/Vue, verify is the root element.
- Page data not refreshing on back navigation: Use Ionic lifecycle hooks () instead of framework-native lifecycle hooks (, , ). Ionic caches pages in the DOM.
- Page transitions not animating: Use the framework's Ionic router integration ( for Angular, for React, from for Vue). Standard framework routers do not trigger Ionic animations.
- CSS custom properties not applying: Ionic components use Shadow DOM. Use documented CSS custom properties (, ) instead of targeting internal elements.
- Icons not showing (Angular standalone): Call from with the required icons and import from
@ionic/angular/standalone
.
Failed to resolve component: ion-*
(Vue): The Ionic component is not imported. Add the import from .
- Tab bar disappears on sub-page (React): All routes (including detail routes) must be inside the within .
- Form input values not updating (React): Use for /, not . Access values via .
- Slot attribute deprecation warning (Vue): Ionic uses Web Component slots. Disable the ESLint rule:
'vue/no-deprecated-slot-attribute': 'off'
.
Related Skills
- — Create a new Ionic app from scratch.
- — General Ionic development, full component API reference.
- — Angular-specific patterns (standalone vs NgModule, navigation, forms, testing).
- — React-specific patterns (IonReactRouter, hooks, state management).
- — Vue-specific patterns (composables, navigation, IonPage requirement).
- — Upgrade Ionic to a newer major version.
capacitor-app-development
— General Capacitor development.
- — Live updates, native builds, and app store publishing.