Skip to content

feat(toggle): add checkedIcon and uncheckedIcon props - #31774

Open
ShaneK wants to merge 5 commits into
feature-9.1from
FW-7639
Open

ShaneK wants to merge 5 commits into
feature-9.1from
FW-7639

Conversation

@ShaneK

@ShaneK ShaneK commented Nov 18, 2026

Copy link
Copy Markdown
Member

Issue number: resolves #30996


What is the current behavior?

Currently, the on/off label icons in ion-toggle are hardcoded per mode, so there's no way to swap them for something like a sun and moon on a dark mode toggle.

What is the new behavior?

  • Added checkedIcon and uncheckedIcon props to ion-toggle, plus toggleCheckedIcon and toggleUncheckedIcon global config options. The props win over the config, and both fall back to the existing mode defaults. Like the defaults, they only show when enableOnOffLabels is true.
  • In ios, the default checked icon is a dash rotated into a vertical line, so a custom checked icon skips that rotation and uses the same size and inset as the unchecked icon.
  • Added both props to the standalone Angular IonToggle inputs, since those aren't generated.

Does this introduce a breaking change?

  • Yes
  • No

It's a new feature, which is why it's pointed at feature-9.1.

Other information

This is based on the original PR by @AbdullahAhmadAAK. That PR pointed at main, but new features now go to feature-9.1, a branch that didn't exist yet when it was opened. Retargeting it would have conflicted, because the generated Angular proxies moved on feature-9.1, so I remade it from feature-9.1 instead. Their commit is still there with them as the author. The commits after it fix the ios checked icon size, keep the md icon at its current size and add tests. Thanks to @AbdullahAhmadAAK for getting this started!

Custom icons test page (MD)
Custom icons test page (iOS)

@ShaneK
ShaneK requested a review from a team as a code owner November 18, 2026 17:30
@ShaneK
ShaneK requested a review from thetaPC November 18, 2026 17:30
@vercel

vercel Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ionic-framework Ready Ready Preview Nov 18, 2026 5:57pm UTC

Request Review

@github-actions github-actions Bot added package: core @ionic/core package package: angular @ionic/angular package package: vue @ionic/vue package labels Nov 18, 2026

@brandyscarney brandyscarney left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The feature looks good but can you fix the screenshots?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The checked toggles are cut off can you fix that?

I think you should be able to use this:

grid-template-columns: auto;

Comment on lines +37 to +39
ion-toggle {
width: 100%;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we remove this rule because it took me like 5 minutes to figure out which toggle went with which label above it 😂

This is how my mind was grouping them:

CleanShot 2026-11-18 at 2 22 07 PM

vs:

CleanShot 2026-11-18 at 2 23 07 PM
Suggested change
ion-toggle {
width: 100%;
}

This branch was successfully deployed

1 active deployment
Preview — 46a1c3a1 Deployed Nov 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: angular @ionic/angular package package: core @ionic/core package package: vue @ionic/vue package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants