Skip to content

docs(config): add code snippets of how to access the mode per framework #4147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

joesphchang
Copy link

@joesphchang joesphchang commented Jun 11, 2025

Added ionic-mode to the appropriate section in Config

Initial issue: Issue #2580

Preview

@joesphchang joesphchang requested a review from a team as a code owner June 11, 2025 17:56
Copy link

vercel bot commented Jun 11, 2025

@joesphchang is attempting to deploy a commit to the Ionic Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

vercel bot commented Jun 12, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ionic-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 26, 2025 7:42pm

@joesphchang joesphchang reopened this Jun 12, 2025
@brandyscarney
Copy link
Member

Thank you for this!

I spoke with the team, and we think it would be clearer if getting the mode were its own section, separate from the get method. This helps make it more obvious that the get method isn't available in all frameworks.

For example, Angular would remain the same:

old

And a new section would be added, either before or after the Angular one:

new

Additionally, we should make sure that all framework examples are consistent. This would be a good use case for adding a playground if we want to apply styles based on the mode. You can see an example of a playground in a guide page here: https://ionicframework.com/docs/utilities/gestures#basic-gestures

And the source code for that example is here: https://github.com/ionic-team/ionic-docs/tree/main/static/usage/v8/gestures/basic

Lastly, we need to make sure this documentation is also added to the v7 directories:

Let me know if you have any questions!

@brandyscarney brandyscarney changed the title docs(config): added given code-snippets to config file docs(config): add code snippets of how to access the mode per framework Jun 13, 2025
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please remove the unrelated changes to your-first-app from this PR? 🙂

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe I removed it and pushed back up the changes!

@brandyscarney brandyscarney requested a review from thetaPC June 23, 2025 15:28
joesphchang and others added 12 commits June 24, 2025 10:39
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…onic-team#4153)

Co-authored-by: Brandy Smith <6577830+brandyscarney@users.noreply.github.com>
…team#4152)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Copy link
Contributor

@thetaPC thetaPC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also some files that are not relevant to this PR. Please revert those.

@@ -51,6 +51,14 @@ import PerPlatformOverridesExample from '@site/docs/developing/config/per-platfo

<PerPlatformOverridesExample />

## Accessing the Current Mode Programmatically
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Accessing the Current Mode Programmatically
## Accessing the Mode

Let's aim for short titles.

<ion-app>
<ion-content>
<div class="container">
<ion-button (click)="showMode()">Show Current Mode</ion-button>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<ion-button (click)="showMode()">Show Current Mode</ion-button>
<ion-button (click)="showMode()">Show Mode</ion-button>

<ion-content>
<div class="container">
<ion-button (click)="showMode()">Show Current Mode</ion-button>
<div class="mode-value">{{ modeValue }}</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update this to be consistent with the text from the demo. This one is missing Current mode: . All the frameworks need to match the demo for consistency.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Stackblitz environment does not work. This can be seen by selecting "Angular" under the tabs and then the StackBlitz logo. The environment needs to be fixed.

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Ionic Config Mode Example</title>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<title>Ionic Config Mode Example</title>
<title>Ionic Config Mode</title>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ionic/core@8/css/ionic.bundle.css" />
<style>
.container {
/* display: block; */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove any unused code.

Suggested change
/* display: block; */

@@ -0,0 +1,15 @@
```html
<button id="showModeBtn">Show Current Mode</button>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be using an ion-button since that's what the demo is using.

return (
<>
<IonButton onClick={showMode}>Show Current Mode</IonButton>
<div className="mode-value">{modeValue && `Current mode: ${modeValue}`}</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have the same styling as the demo. Same reason, for consistency.

```html
<template>
<ion-button @click="showMode">Show Current Mode</ion-button>
<div class="mode-value" v-if="modeValue">Current mode: {{ modeValue }}</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have the same styling as the demo. Same reason, for consistency.

<ion-app>
<ion-content>
<div class="container">
<ion-button id="showModeBtn">Show Current Mode</ion-button>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change the button to be more visual based. For example, let's set the color and fill based on the mode and the button text should be the mode.

<IonButton color={mode === 'ios' ? 'secondary' : 'tertiary'} fill={mode === 'ios' ? 'outline' : 'solid'}>
   {mode}
</IonButton>

The example is in React, just update the code to be appropriate per framework.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants