diff --git a/docs/angular/quickstart.md b/docs/angular/quickstart.md
index fa4505c70d..e2d7b1436f 100644
--- a/docs/angular/quickstart.md
+++ b/docs/angular/quickstart.md
@@ -55,22 +55,24 @@ After running `ionic serve`, your project will open in the browser.
## Explore the Project Structure
-Your new app's `src/app` directory will look like this:
+Your new app's directory will look like this:
```shell
-├── app.component.html
-├── app.component.scss
-├── app.component.ts
-├── app.routes.ts
-└── home/
- ├── home.page.html
- ├── home.page.scss
- ├── home.page.spec.ts
- └── home.page.ts
+└── src/
+ └── app
+ ├── app.component.html
+ ├── app.component.scss
+ ├── app.component.ts
+ ├── app.routes.ts
+ └── home/
+ ├── home.page.html
+ ├── home.page.scss
+ ├── home.page.spec.ts
+ └── home.page.ts
```
:::info
-All file paths in the examples below are relative to the `src/app/` directory.
+All file paths in the examples below are relative to the project root directory.
:::
Let's walk through these files to understand the app's structure.
@@ -79,7 +81,7 @@ Let's walk through these files to understand the app's structure.
The root of your app is defined in `app.component.ts`:
-```ts
+```ts title="src/app/app.component.ts"
import { Component } from '@angular/core';
import { IonApp, IonRouterOutlet } from '@ionic/angular/standalone';
@@ -95,7 +97,7 @@ export class AppComponent {
And its template in `app.component.html`:
-```html
+```html title="src/app/app.component.html"
@@ -107,7 +109,7 @@ This sets up the root of your application, using Ionic's `ion-app` and `ion-rout
Routes are defined in `app.routes.ts`:
-```ts
+```ts title="src/app/app.routes.ts"
import { Routes } from '@angular/router';
export const routes: Routes = [
@@ -127,9 +129,9 @@ When you visit the root URL (`/`), the `HomePage` component will be loaded.
## View the Home Page
-The Home page component, defined in `home/home.page.ts`, imports the Ionic components it uses:
+The Home page component, defined in `home.page.ts`, imports the Ionic components it uses:
-```ts
+```ts title="src/app/home/home.page.ts"
import { Component } from '@angular/core';
import { IonHeader, IonToolbar, IonTitle, IonContent } from '@ionic/angular/standalone';
@@ -146,7 +148,7 @@ export class HomePage {
And the template, in the `home.page.html` file, uses those components:
-```html
+```html title="src/app/home/home.page.html"
Blank
@@ -170,17 +172,17 @@ And the template, in the `home.page.html` file, uses those components:
```
-This creates a page with a header and scrollable content area. The second header shows a [collapsible large title](/docs/api/title#collapsible-large-titles) that displays when at the top of the content, then condenses to show the smaller title in the first header when scrolling down.
+This creates a page with a header and scrollable content area. The second header shows a [collapsible large title](/docs/api/title.md#collapsible-large-titles) that displays when at the top of the content, then condenses to show the smaller title in the first header when scrolling down.
:::tip Learn More
-For detailed information about Ionic layout components, see the [Header](/docs/api/header), [Toolbar](/docs/api/toolbar), [Title](/docs/api/title), and [Content](/docs/api/content) documentation.
+For detailed information about Ionic layout components, see the [Header](/docs/api/header.md), [Toolbar](/docs/api/toolbar.md), [Title](/docs/api/title.md), and [Content](/docs/api/content.md) documentation.
:::
## Add an Ionic Component
-You can enhance your Home page with more Ionic UI components. For example, add a [Button](/docs/api/button) at the end of the `ion-content`:
+You can enhance your Home page with more Ionic UI components. For example, add a [Button](/docs/api/button.md) at the end of the `ion-content`:
-```html
+```html title="src/app/home/home.page.html"
@@ -190,7 +192,7 @@ You can enhance your Home page with more Ionic UI components. For example, add a
Then, import the `IonButton` component in `home.page.ts`:
-```ts
+```ts title="src/app/home/home.page.ts"
import { IonButton, IonContent, IonHeader, IonTitle, IonToolbar } from '@ionic/angular/standalone';
@Component({
@@ -209,9 +211,9 @@ ionic generate page new
A route will be automatically added to `app.routes.ts`.
-In your `new/new.page.html`, you can add a [Back Button](/docs/api/back-button) to the [Toolbar](/docs/api/toolbar):
+In `new.page.html`, you can add a [Back Button](/docs/api/back-button.md) to the [Toolbar](/docs/api/toolbar.md):
-```html
+```html title="src/app/new/new.page.html"
@@ -222,9 +224,9 @@ In your `new/new.page.html`, you can add a [Back Button](/docs/api/back-button)
```
-And import `IonBackButton` and `IonButtons` in `new/new.page.ts`:
+And import `IonBackButton` and `IonButtons` in `new.page.ts`:
-```ts
+```ts title="src/app/new/new.page.ts"
import { IonBackButton, IonButtons, IonContent, IonHeader, IonTitle, IonToolbar } from '@ionic/angular/standalone';
@Component({
@@ -237,15 +239,15 @@ The `ion-back-button` will automatically handle navigation back to the previous
## Navigate to the New Page
-To navigate to the new page, update the button in `home/home.page.html`:
+To navigate to the new page, update the button in `home.page.html`:
-```html
+```html title="src/app/home/home.page.html"
Navigate
```
-Then, import `RouterLink` in `home/home.page.ts`:
+Then, import `RouterLink` in `home.page.ts`:
-```ts
+```ts title="src/app/home/home.page.ts"
import { RouterLink } from '@angular/router';
@Component({
@@ -255,14 +257,14 @@ import { RouterLink } from '@angular/router';
```
:::info
-Navigating can also be performed using Angular's Router service. See the [Angular Navigation documentation](/docs/angular/navigation#navigating-to-different-routes) for more information.
+Navigating can also be performed using Angular's Router service. See the [Angular Navigation documentation](/docs/angular/navigation.md#navigating-to-different-routes) for more information.
:::
## Add Icons to the New Page
-Ionic Angular comes with [Ionicons](https://ionic.io/ionicons/) pre-installed. You can use any icon by setting the `name` property on the `ion-icon` component. Add the following icons to `new/new.page.html`:
+Ionic Angular comes with [Ionicons](https://ionic.io/ionicons/) pre-installed. You can use any icon by setting the `name` property on the `ion-icon` component. Add the following icons to `new.page.html`:
-```html
+```html title="src/app/new/new.page.html"
@@ -271,9 +273,9 @@ Ionic Angular comes with [Ionicons](https://ionic.io/ionicons/) pre-installed. Y
```
-You'll also need to import and register these icons in `new/new.page.ts`:
+You'll also need to import and register these icons in `new.page.ts`:
-```ts
+```ts title="src/app/new/new.page.ts"
// ...existing imports...
import { IonBackButton, IonButtons, IonContent, IonHeader, IonIcon, IonTitle, IonToolbar } from '@ionic/angular/standalone';
import { addIcons } from 'ionicons';
@@ -287,7 +289,7 @@ import { heart, logoIonic } from 'ionicons/icons';
Then, update the constructor of the page to use `addIcons`:
-```ts
+```ts title="src/app/new/new.page.ts"
export class NewPage implements OnInit {
constructor() {
addIcons({ heart, logoIonic });
@@ -299,15 +301,15 @@ export class NewPage implements OnInit {
Alternatively, you can register icons in `app.component.ts` to use them throughout your app.
-For more information, see the [Icon documentation](/docs/api/icon) and the [Ionicons documentation](https://ionic.io/ionicons/).
+For more information, see the [Icon documentation](/docs/api/icon.md) and the [Ionicons documentation](https://ionic.io/ionicons/).
## Call Component Methods
Let's add a button that can scroll the content area to the bottom.
-Update the `ion-content` in your `new/new.page.html` to include a button and some items after the existing icons:
+Update the `ion-content` in your `new.page.html` to include a button and some items after the existing icons:
-```html
+```html title="src/app/new/new.page.html"
@@ -331,7 +333,7 @@ Update the `ion-content` in your `new/new.page.html` to include a button and som
In the component, add the `ViewChild` import, the new component imports and define the `scrollToBottom` function:
-```ts
+```ts title="src/app/new/new.page.ts"
import { Component, OnInit, ViewChild } from '@angular/core';
import {
IonBackButton,
@@ -385,7 +387,7 @@ To call methods on Ionic components:
1. Create a `ViewChild` reference for the component
2. Call the method directly on the component instance
-You can find available methods for each component in the [Methods](/docs/api/content#methods) section of their API documentation.
+You can find available methods for each component in the [Methods](/docs/api/content.md#methods) section of their API documentation.
## Run on a Device
diff --git a/docs/javascript/quickstart.md b/docs/javascript/quickstart.md
index 7d958bc4a9..7da5f0e77f 100644
--- a/docs/javascript/quickstart.md
+++ b/docs/javascript/quickstart.md
@@ -87,7 +87,7 @@ npm install vite-plugin-static-copy --save-dev
Add a `vite.config.js` file at the project root with the following:
-```js
+```js title="vite.config.js"
import { defineConfig } from 'vite';
import { viteStaticCopy } from 'vite-plugin-static-copy';
@@ -120,20 +120,16 @@ This copies the necessary Ionic files that Capacitor will need to work with lazy
## Initialize Ionic
-Replace the contents of `src/main.js` with the following:
-
-```js
-// Determine if the app is running in Capacitor
-const isCapacitor = location.protocol === 'capacitor:' || (window.Capacitor && window.Capacitor.platform !== 'web');
+Replace the contents of `main.js` with the following:
+```js title="src/main.js"
// Load Ionic
-if (isCapacitor) {
- // In Capacitor, import Ionic directly from copied dist files
- import(/* @vite-ignore */ location.origin + '/ionic.esm.js');
-} else {
- // In the browser, use the normal loader
- import('@ionic/core/loader').then((m) => m.defineCustomElements(window));
-}
+(async () => {
+ // Set the path to a variable to
+ // prevent Vite from analyzing in dev
+ const ionicPath = '/ionic.esm.js';
+ await import(/* @vite-ignore */ ionicPath);
+})();
// Core CSS required for Ionic components to work properly
import '@ionic/core/css/core.css';
@@ -158,7 +154,7 @@ This initializes Ionic based on the environment and then imports all of the avai
Update your `index.html` to configure the metadata and use Ionic components:
-```html
+```html title="index.html"
@@ -190,7 +186,7 @@ This sets up the root of your application, using Ionic's `ion-app`, `ion-router`
Routes are defined in the `index.html` using `ion-route` components inside the `ion-router`:
-```html
+```html title="index.html"
@@ -203,7 +199,7 @@ When you visit the root URL (`/`), the `home-page` component will be loaded. Whe
Create a new directory called `pages` inside the `src` folder, then add a file called `HomePage.js` in that directory with the following content:
-```js
+```js title="src/pages/HomePage.js"
class HomePage extends HTMLElement {
connectedCallback() {
this.innerHTML = `
@@ -231,12 +227,12 @@ customElements.define('home-page', HomePage);
This creates a custom element called `home-page` that contains the layout for your Home page. The page uses Ionic's layout components to create a header with a toolbar and scrollable content area.
:::tip Learn More
-For detailed information about Ionic layout components, see the [Header](/docs/api/header), [Toolbar](/docs/api/toolbar), [Title](/docs/api/title), and [Content](/docs/api/content) documentation.
+For detailed information about Ionic layout components, see the [Header](/docs/api/header.md), [Toolbar](/docs/api/toolbar.md), [Title](/docs/api/title.md), and [Content](/docs/api/content.md) documentation.
:::
-Next, add a `
@@ -250,9 +246,9 @@ At this point your browser should be displaying the Home page.
## Add an Ionic Component
-You can enhance your Home page with more Ionic UI components. For example, add a [Button](/docs/api/button) to navigate to another page. Update the `HomePage` component in `src/pages/HomePage.js`:
+You can enhance your Home page with more Ionic UI components. For example, add a [Button](/docs/api/button.md) to navigate to another page. Update the `HomePage` component in `HomePage.js`:
-```js
+```js title="src/pages/HomePage.js"
class HomePage extends HTMLElement {
connectedCallback() {
this.innerHTML = `
@@ -283,7 +279,7 @@ customElements.define('home-page', HomePage);
Add a new file named `NewPage.js` to `src/pages` with the following content:
-```js
+```js title="src/pages/NewPage.js"
class NewPage extends HTMLElement {
connectedCallback() {
this.innerHTML = `
@@ -305,11 +301,11 @@ class NewPage extends HTMLElement {
customElements.define('new-page', NewPage);
```
-This creates a page with a [Back Button](/docs/api/back-button) in the [Toolbar](/docs/api/toolbar). The back button will automatically handle navigation back to the previous page, or to `/` if there is no history.
+This creates a page with a [Back Button](/docs/api/back-button.md) in the [Toolbar](/docs/api/toolbar.md). The back button will automatically handle navigation back to the previous page, or to `/` if there is no history.
Next, update the `
@@ -187,9 +188,9 @@ import { IonButton, IonContent, IonHeader, IonPage, IonTitle, IonToolbar } from
## Add a New Page
-Create a new page at `views/NewPage.vue`:
+Create a new page at `NewPage.vue`:
-```vue
+```vue title="src/views/NewPage.vue"
@@ -216,9 +217,9 @@ import { IonBackButton, IonButtons, IonContent, IonHeader, IonPage, IonTitle, Io
```
-This creates a page with a [Back Button](/docs/api/back-button) in the [Toolbar](/docs/api/toolbar). The back button will automatically handle navigation back to the previous page, or to `/` if there is no history.
+This creates a page with a [Back Button](/docs/api/back-button.md) in the [Toolbar](/docs/api/toolbar.md). The back button will automatically handle navigation back to the previous page, or to `/` if there is no history.
-:::warning Important
+:::warning
When creating your own pages, always use `ion-page` as the root component. This is essential for proper transitions between pages, base CSS styling that Ionic components depend on, and consistent layout behavior across your app.
:::
@@ -226,15 +227,13 @@ When creating your own pages, always use `ion-page` as the root component. This
To navigate to the new page, create a route for it by first importing it at the top of `router/index.ts` after the `HomePage` import:
-To navigate to a new page, add the route to `router/index.ts`
-
-```tsx
+```ts title="src/router/index.ts"
import NewPage from '../views/NewPage.vue';
```
Then, add its route in the `routes` array:
-```tsx
+```ts title="src/router/index.ts"
const routes: Array = [
{
path: '/',
@@ -253,23 +252,23 @@ const routes: Array = [
];
```
-Once that is done, update the button in `views/HomePage.vue`:
+Once that is done, update the button in `HomePage.vue`:
-```vue
+```vue title="src/views/HomePage.vue"
Navigate
```
:::info
-Navigating can also be performed programmatically using Vue Router, and routes can be lazy loaded for better performance. See the [Vue Navigation documentation](/docs/vue/navigation) for more information.
+Navigating can also be performed programmatically using Vue Router, and routes can be lazy loaded for better performance. See the [Vue Navigation documentation](/docs/vue/navigation.md) for more information.
:::
## Add Icons to the New Page
Ionic Vue comes with [Ionicons](https://ionic.io/ionicons/) pre-installed. You can use any icon by setting the `icon` property of the `ion-icon` component.
-Update the imports in `views/NewPage.vue` to import `IonIcon` and the `heart` and `logoIonic` icons:
+Update the imports in `NewPage.vue` to import `IonIcon` and the `heart` and `logoIonic` icons:
-```vue
+```vue title="src/views/NewPage.vue"
```
-This creates a page with a header and scrollable content area. The second header shows a [collapsible large title](/docs/api/title#collapsible-large-titles) that displays when at the top of the content, then condenses to show the smaller title in the first header when scrolling down.
+This creates a page with a header and scrollable content area. The second header shows a [collapsible large title](/docs/api/title.md#collapsible-large-titles) that displays when at the top of the content, then condenses to show the smaller title in the first header when scrolling down.
:::tip Learn More
-For detailed information about Ionic layout components, see the [Header](/docs/api/header), [Toolbar](/docs/api/toolbar), [Title](/docs/api/title), and [Content](/docs/api/content) documentation.
+For detailed information about Ionic layout components, see the [Header](/docs/api/header.md), [Toolbar](/docs/api/toolbar.md), [Title](/docs/api/title.md), and [Content](/docs/api/content.md) documentation.
:::
## Add an Ionic Component
-You can enhance your Home page with more Ionic UI components. For example, add a [Button](/docs/api/button) at the end of the `ion-content`:
+You can enhance your Home page with more Ionic UI components. For example, add a [Button](/docs/api/button.md) at the end of the `ion-content`:
-```html
+```vue title="src/views/HomePage.vue"
@@ -179,17 +180,17 @@ You can enhance your Home page with more Ionic UI components. For example, add a
Then, import the `IonButton` component in the `
```
## Add a New Page
-Create a new page at `views/NewPage.vue`:
+Create a new page at `NewPage.vue`:
-```html
+```vue title="src/views/NewPage.vue"
@@ -212,13 +213,13 @@ Create a new page at `views/NewPage.vue`:
```
-This creates a page with a [Back Button](/docs/api/back-button) in the [Toolbar](/docs/api/toolbar). The back button will automatically handle navigation back to the previous page, or to `/` if there is no history.
+This creates a page with a [Back Button](/docs/api/back-button.md) in the [Toolbar](/docs/api/toolbar.md). The back button will automatically handle navigation back to the previous page, or to `/` if there is no history.
-:::warning Important
+:::warning
When creating your own pages, always use `ion-page` as the root component. This is essential for proper transitions between pages, base CSS styling that Ionic components depend on, and consistent layout behavior across your app.
:::
@@ -226,15 +227,13 @@ When creating your own pages, always use `ion-page` as the root component. This
To navigate to the new page, create a route for it by first importing it at the top of `router/index.ts` after the `HomePage` import:
-To navigate to a new page, add the route to `router/index.ts`
-
-```tsx
+```ts title="src/router/index.ts"
import NewPage from '../views/NewPage.vue';
```
Then, add its route in the `routes` array:
-```tsx
+```ts title="src/router/index.ts"
const routes: Array = [
{
path: '/',
@@ -253,47 +252,47 @@ const routes: Array = [
];
```
-Once that is done, update the button in `views/HomePage.vue`:
+Once that is done, update the button in `HomePage.vue`:
-```tsx
+```vue title="src/views/HomePage.vue"
Navigate
```
:::info
-Navigating can also be performed programmatically using Vue Router, and routes can be lazy loaded for better performance. See the [Vue Navigation documentation](/docs/vue/navigation) for more information.
+Navigating can also be performed programmatically using Vue Router, and routes can be lazy loaded for better performance. See the [Vue Navigation documentation](/docs/vue/navigation.md) for more information.
:::
## Add Icons to the New Page
Ionic Vue comes with [Ionicons](https://ionic.io/ionicons/) pre-installed. You can use any icon by setting the `icon` property of the `ion-icon` component.
-Update the imports in `views/NewPage.vue` to import `IonIcon` and the `heart` and `logoIonic` icons:
+Update the imports in `NewPage.vue` to import `IonIcon` and the `heart` and `logoIonic` icons:
-```html
+```vue title="src/views/NewPage.vue"
```
Then, include them inside of the `ion-content`:
-```tsx
+```vue title="src/views/NewPage.vue"
```
Note that we are passing the imported SVG reference, **not** the icon name as a string.
-For more information, see the [Icon documentation](/docs/api/icon) and the [Ionicons documentation](https://ionic.io/ionicons/).
+For more information, see the [Icon documentation](/docs/api/icon.md) and the [Ionicons documentation](https://ionic.io/ionicons/).
## Call Component Methods
Let's add a button that can scroll the content area to the bottom.
-Update `views/NewPage.vue` to include a ref on `ion-content` and a button and some items after the existing icons:
+Update `NewPage.vue` to include a ref on `ion-content` and a button and some items after the existing icons:
-```html
+```vue title="src/views/NewPage.vue"
Scroll to Bottom
@@ -306,29 +305,29 @@ Update `views/NewPage.vue` to include a ref on `ion-content` and a button and so
In the script section, add the new component imports and define the `scrollToBottom` function:
-```html
+```vue title="src/views/NewPage.vue"
```
@@ -340,7 +339,7 @@ To call methods on Ionic components:
This pattern is necessary because Ionic components are built as Web Components. The `$el` property gives you access to the actual Web Component instance where the methods are defined.
-You can find available methods for each component in the [Methods](/docs/api/content#methods) section of their API documentation.
+You can find available methods for each component in the [Methods](/docs/api/content.md#methods) section of their API documentation.
## Run on a Device
@@ -371,15 +370,15 @@ Ionic Vue projects are created with TypeScript by default, but you can easily co
npm uninstall --save typescript @types/jest @typescript-eslint/eslint-plugin @typescript-eslint/parser @vue/cli-plugin-typescript @vue/eslint-config-typescript vue-tsc
```
-2. Change the extension of all `.ts` files to `.js`. In a blank Ionic Vue app, this will be the `router/index.ts`, `main.ts`, and files in the `tests` directory.
+2. Change the extension of all `.ts` files to `.js`. In a blank Ionic Vue app, this will be the `src/router/index.ts`, `src/main.ts`, and files in the `tests` directory.
3. In `index.html`, change the imported `
@@ -187,9 +188,9 @@ import { IonButton, IonContent, IonHeader, IonPage, IonTitle, IonToolbar } from
## Add a New Page
-Create a new page at `views/NewPage.vue`:
+Create a new page at `NewPage.vue`:
-```vue
+```vue title="src/views/NewPage.vue"
@@ -216,9 +217,9 @@ import { IonBackButton, IonButtons, IonContent, IonHeader, IonPage, IonTitle, Io
```
-This creates a page with a [Back Button](/docs/api/back-button) in the [Toolbar](/docs/api/toolbar). The back button will automatically handle navigation back to the previous page, or to `/` if there is no history.
+This creates a page with a [Back Button](/docs/api/back-button.md) in the [Toolbar](/docs/api/toolbar.md). The back button will automatically handle navigation back to the previous page, or to `/` if there is no history.
-:::warning Important
+:::warning
When creating your own pages, always use `ion-page` as the root component. This is essential for proper transitions between pages, base CSS styling that Ionic components depend on, and consistent layout behavior across your app.
:::
@@ -226,15 +227,13 @@ When creating your own pages, always use `ion-page` as the root component. This
To navigate to the new page, create a route for it by first importing it at the top of `router/index.ts` after the `HomePage` import:
-To navigate to a new page, add the route to `router/index.ts`
-
-```tsx
+```ts title="src/router/index.ts"
import NewPage from '../views/NewPage.vue';
```
Then, add its route in the `routes` array:
-```tsx
+```ts title="src/router/index.ts"
const routes: Array = [
{
path: '/',
@@ -253,23 +252,23 @@ const routes: Array = [
];
```
-Once that is done, update the button in `views/HomePage.vue`:
+Once that is done, update the button in `HomePage.vue`:
-```vue
+```vue title="src/views/HomePage.vue"
Navigate
```
:::info
-Navigating can also be performed programmatically using Vue Router, and routes can be lazy loaded for better performance. See the [Vue Navigation documentation](/docs/vue/navigation) for more information.
+Navigating can also be performed programmatically using Vue Router, and routes can be lazy loaded for better performance. See the [Vue Navigation documentation](/docs/vue/navigation.md) for more information.
:::
## Add Icons to the New Page
Ionic Vue comes with [Ionicons](https://ionic.io/ionicons/) pre-installed. You can use any icon by setting the `icon` property of the `ion-icon` component.
-Update the imports in `views/NewPage.vue` to import `IonIcon` and the `heart` and `logoIonic` icons:
+Update the imports in `NewPage.vue` to import `IonIcon` and the `heart` and `logoIonic` icons:
-```vue
+```vue title="src/views/NewPage.vue"