Ionic Cheat Sheet
|
This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production. |
A compact reference for the Ionic and Capacitor essentials used by the Trailhead example (com.example.trailhead).
Baseline: Ionic Framework 9.0.10, Ionic CLI 7.2.1, Capacitor 8.6.0, Angular 22.2.5 with standalone components and
signals, Node 22+. For explanations see the pages listed at the end.
CLI Commands
| Command | Purpose |
|---|---|
|
Install the Ionic CLI |
|
Scaffold a project from a starter |
|
Run in the browser with live reload |
|
Production web build |
|
Create the native projects |
|
Copy web build and config, update plugins |
|
Copy web build and config only |
|
Open Android Studio or Xcode |
|
Build and run on a device or emulator |
|
Check the environment and plugin versions |
|
Upgrade Capacitor to a new major version |
|
Generate icons and splash screens |
Project Layout
| Path | Contents |
|---|---|
|
Standalone components, services, routes |
|
Ionic theme variables |
|
Global styles and Ionic CSS imports |
|
|
|
Native projects, committed to Git |
|
Web build output ( |
Components
| Component | Use |
|---|---|
|
Root and page outlet |
|
Page header |
|
Scrollable body, handles safe areas |
|
Lists and rows |
|
Search input (Trailhead trail search) |
|
Actions and icons |
|
Tab navigation |
|
Overlays |
|
Pull to refresh, paging |
Import each from @ionic/angular/standalone into the component’s imports array and register icons with
addIcons() from ionicons.
Theming
| Variable | Effect |
|---|---|
|
Primary colour (plus |
|
App background |
|
Default text colour |
|
App font |
|
Safe-area inset exposed by Ionic |
|
Per-component custom properties |
Dark mode comes from importing one of Ionic’s dark palette stylesheets or from prefers-color-scheme. Mode
(ios or md) follows the platform unless overridden in provideIonicAngular({ mode: 'md' }).
Routing and Lifecycle
| Item | Notes |
|---|---|
|
Register routes in |
|
Lazy-load a page |
|
Programmatic and declarative navigation |
|
Page about to show; refresh data here |
|
Page fully shown |
|
Page hiding or hidden |
|
Runs once; cached pages do not re-run it |
Plugins
| Plugin | Example |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
After installing a plugin run npx cap sync, then declare permissions in AndroidManifest.xml and Info.plist.
Wrap plugins in services so tests can replace them.
Storage
| Need | Use |
|---|---|
Small settings |
|
Files and photos |
|
Relational data |
|
Structured browser data |
IndexedDB |
Tokens |
Keychain and Keystore backed plugin |
Build and Release
| Command | Result |
|---|---|
|
Release APK |
|
Release AAB for Google Play |
Xcode: Product, Archive |
iOS archive for TestFlight |
|
Android build and marketing version |
|
iOS build number |
|
Optional over-the-air web updates |
Testing
| Command | Purpose |
|---|---|
|
Unit and component tests |
|
Browser end-to-end tests (Playwright 1.65.0) |
|
Debug the Android WebView |
Safari Develop menu |
Debug the iOS WebView |
Pages in This Section
UI — Components and Theming and Navigation and Routing.
Device and data — Capacitor Plugins, Data, Storage and Networking and Platform Integration.
Quality and delivery — Testing and Building and Releasing.
Related — Hybrid Apps, Hybrid Apps: IDEs & Tools, React Native and Media Optimization.