Skip to content

feat(icon): add font icon support to ion-icon - #1499

Merged
brandyscarney merged 37 commits into
feature-8.1from
FW-7618
Jul 28, 2026
Merged

feat(icon): add font icon support to ion-icon#1499
brandyscarney merged 37 commits into
feature-8.1from
FW-7618

Conversation

@brandyscarney

@brandyscarney brandyscarney commented Jul 22, 2026

Copy link
Copy Markdown
Member

Description

Adds support for slotted content in the ion-icon component, enabling developers to use custom icons via any content type: font icons, SVGs, or other icon components.

Change Type

  • Fix
  • Feature
  • Refactor
  • Breaking Change
  • Documentation
  • Other (CI, chores, etc.)

Rationale / Problems Fixed

Provides flexibility for developers who want to use custom icon implementations alongside SVG icons. The slotted content support allows the ion-icon component to wrap and style various icon formats (font icons, custom SVGs, icon components) with a unified interface, while developers benefit from all of the ionic framework component styling applied to ion-icon.

Implementation Details

  • Added <slot></slot> support to the ion-icon component JSX to accept slotted content
  • Updated CSS to support flexbox layout for slotted content alignment
  • Changed contain: strict to contain: layout style to allow better integration with slotted content
  • Added ::slotted(*) styles to inherit font size from the host element for proper sizing
  • Added visual regression tests for slotted content

Example Usage

<!-- Font icons -->
<ion-icon>
  <i class="fa fa-home"></i>
</ion-icon>

<!-- Slotted SVGs -->
<ion-icon>
  <svg>...</svg>
</ion-icon>

<!-- Other icon components -->
<ion-icon>
  <custom-icon></custom-icon>
</ion-icon>

Dev Build

8.0.14-dev.11785269740.1e15c0b8


.icon-inner,
.icon-inner {
display: flex;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We need flex here for the font icons, otherwise they are shifted to the right and down. Since developers can't override this, we could expose this as a part if it's an issue.

Comment thread jest.setup.js
Comment thread src/components/icon/test/icon.spec.ts
@brandyscarney
brandyscarney marked this pull request as ready for review July 23, 2026 18:09
@ShaneK
ShaneK requested a review from Copilot July 24, 2026 13:35

This comment was marked as off-topic.

@ShaneK ShaneK 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.

Looking good! Just a thing I noticed, but I could be off base here

Comment thread src/components/icon/test/a11y/index.html Outdated
@brandyscarney
brandyscarney requested a review from ShaneK July 24, 2026 16:31

@ShaneK ShaneK 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.

LGTM!

@thetaPC thetaPC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, just minor question

Comment thread src/components/icon/test/icon.spec.ts
Base automatically changed from chore/ionicons-align-build-tests to main July 28, 2026 18:18
@brandyscarney
brandyscarney changed the base branch from main to feature-8.1 July 28, 2026 20:13
@brandyscarney
brandyscarney merged commit 36a42ee into feature-8.1 Jul 28, 2026
10 checks passed
@brandyscarney
brandyscarney deleted the FW-7618 branch July 28, 2026 20:23
@brandyscarney
brandyscarney restored the FW-7618 branch July 28, 2026 20:34
@brandyscarney
brandyscarney deleted the FW-7618 branch July 28, 2026 20:36
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.

5 participants