Ionic

Cross-platform mobile app development

Ionic Overview

Ionic is a complete open-source SDK for hybrid mobile app development created by Max Lynch, Ben Sperry, and Adam Bradley of Drifty Co. in 2013. Ionic provides tools and services for developing hybrid mobile apps using Web technologies like CSS, HTML5, and Sass.

Initial release

2013

Stable release

7.0.0 (May 2023)

Written in

TypeScript, JavaScript

License

MIT License

Key Features

Common Use Cases

Hybrid Mobile Apps

Apps that run on multiple platforms.

Progressive Web Apps

Web apps with native-like features.

Enterprise Apps

Internal business applications.

Prototyping

Quickly build app prototypes.

Example Code

// Ionic React component example
import { IonContent, IonHeader, IonPage, IonTitle, IonToolbar, IonButton } from '@ionic/react';
import React, { useState } from 'react';

const Home: React.FC = () => {
  const [count, setCount] = useState(0);

  return (
    <IonPage>
      <IonHeader>
        <IonToolbar>
          <IonTitle>Ionic React App</IonTitle>
        </IonToolbar>
      </IonHeader>
      <IonContent className="ion-padding">
        <p>Count: {count}</p>
        <IonButton onClick={() => setCount(count + 1)}>Increment</IonButton>
      </IonContent>
    </IonPage>
  );
};

export default Home;

// Ionic Angular component example
/*
import { Component } from '@angular/core';
import { AlertController } from '@ionic/angular';

@Component({
  selector: 'app-home',
  templateUrl: 'home.page.html',
  styleUrls: ['home.page.scss'],
})
export class HomePage {
  constructor(private alertController: AlertController) {}

  async showAlert() {
    const alert = await this.alertController.create({
      header: 'Alert',
      message: 'This is an alert!',
      buttons: ['OK']
    });

    await alert.present();
  }
}
*/

// Ionic Vue component example
/*
<template>
  <ion-page>
    <ion-header>
      <ion-toolbar>
        <ion-title>Ionic Vue App</ion-title>
      </ion-toolbar>
    </ion-header>
    <ion-content>
      <ion-button @click="increment">Count: {{ count }}</ion-button>
    </ion-content>
  </ion-page>
</template>

<script>
import { ref } from 'vue';
import { IonPage, IonHeader, IonToolbar, IonTitle, IonContent, IonButton } from '@ionic/vue';

export default {
  components: { IonPage, IonHeader, IonToolbar, IonTitle, IonContent, IonButton },
  setup() {
    const count = ref(0);
    const increment = () => count.value++;
    
    return { count, increment };
  }
}
</script>
*/

Learning Resources