Skip to content

feat(icons): add icon set swapping support#8123

Merged
mcoker merged 4 commits into
patternfly:mainfrom
kmcfaul:icon-swap
Feb 12, 2026
Merged

feat(icons): add icon set swapping support#8123
mcoker merged 4 commits into
patternfly:mainfrom
kmcfaul:icon-swap

Conversation

@kmcfaul

@kmcfaul kmcfaul commented Feb 12, 2026

Copy link
Copy Markdown
Contributor

Closes #8072.

Adds class for a default/PF icon (pf-v6-icon-default), a RH-ui set icon (pf-v6-icon-rh-ui), and a class to control when RH-ui icons should be displayed instead of PF icons (pf-v6-icons-rh-ui).

The svg for an icon that has a mapping between PF + RH icons will have a nested structure, with an outer svg containing most of the shared properties & pf-v6-svg, and two inner svgs (one with pf-v6-icon-default and one with pf-v6-icon-rh-ui) that contain their respective path data and viewbox properties.

Let me know what you think about these class names, I'm open to suggestions & not 100% on the preference between hyphens and underscores.

Summary by CodeRabbit

  • Style
    • Adjusted SVG icon visibility: a specific UI icon is hidden by default and only revealed when using its designated icon set.
    • Produces more consistent icon presentation, prevents unintended icon collisions, and ensures the correct icon appears when the corresponding icon group is used.

@coderabbitai

coderabbitai Bot commented Feb 12, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

Adds SCSS rules that hide the icon-rh-ui SVG class by default and, inside the icon-set-rh-ui group, hide the icon-default class and set icon-rh-ui to display: revert to enable class-driven icon swapping.

Changes

Cohort / File(s) Summary
Icon visibility rules
src/patternfly/base/patternfly-svg-icons.scss
Hide .#{$pf-prefix}icon-rh-ui by default; within the icon-set-rh-ui / .icons-rh-ui group, hide .#{$pf-prefix}icon-default and set .#{$pf-prefix}icon-rh-ui to display: revert to support toggling between PF and RH icons.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

  • #8072 — Implements the CSS visibility rules required by the icon-swap classes described in the issue.
  • patternfly/patternfly-react#12220 — SCSS changes here align with that PR’s behavior to hide the default icon and show the RH UI icon.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (5 files):

⚔️ src/patternfly/base/patternfly-common.scss (content)
⚔️ src/patternfly/base/patternfly-svg-icons.scss (content)
⚔️ src/patternfly/components/Table/examples/Table.md (content)
⚔️ src/patternfly/components/Table/table-grid.scss (content)
⚔️ src/patternfly/demos/Table/examples/Table.md (content)

These conflicts must be resolved before merging into main.
Resolve conflicts locally and push changes to this branch.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title follows conventional commit guidelines with a valid type (feat) and scope (icons), and accurately reflects the main objective of adding icon set swapping support.
Linked Issues check ✅ Passed The changes implement the required CSS classes and display logic for icon swapping: pf-v6-icon-default and pf-v6-icon-rh-ui classes control visibility, with default showing PF icons and revert display when theme control is applied.
Out of Scope Changes check ✅ Passed All changes in the SCSS file are directly related to implementing the icon swapping feature and fall within the scope of the linked issue #8072.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


No actionable comments were generated in the recent review. 🎉


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kmcfaul

kmcfaul commented Feb 12, 2026

Copy link
Copy Markdown
Contributor Author

For testing, I manually pulled an svg from the react PR with updated class names into the local build. Here's one I was using to showcase/test the classes that can be used in this PR preview:

<svg class="pf-v6-svg" fill="currentColor" aria-labelledby="icon-title-46" role="img" width="1em" height="1em"><title id="icon-title-46">AngleDoubleDownIcon</title><svg viewBox="0 0 320 512" class="pf-v6-icon-default"><path d="M143 256.3L7 120.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0L313 86.3c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.4 9.5-24.6 9.5-34 .1zm34 192l136-136c9.4-9.4 9.4-24.6 0-33.9l-22.6-22.6c-9.4-9.4-24.6-9.4-33.9 0L160 352.1l-96.4-96.4c-9.4-9.4-24.6-9.4-33.9 0L7 278.3c-9.4 9.4-9.4 24.6 0 33.9l136 136c9.4 9.5 24.6 9.5 34 .1z"></path></svg><svg viewBox="0 0 32 32" class="pf-v6-icon-rh-ui"><path d="M29.707 16.293a.999.999 0 0 1 0 1.414L17.061 30.353c-.292.292-.677.438-1.061.438s-.769-.146-1.061-.438L2.293 17.707a.999.999 0 1 1 1.414-1.414L16 28.586l12.293-12.293a.999.999 0 0 1 1.414 0Zm-14.768.061c.292.292.677.438 1.061.438s.769-.146 1.061-.438L29.707 3.707a.999.999 0 1 0-1.414-1.414L16 14.586 3.707 2.293a.999.999 0 1 0-1.414 1.414l12.646 12.646Z"></path></svg></svg>

@patternfly-build

patternfly-build commented Feb 12, 2026

Copy link
Copy Markdown
Collaborator

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@src/patternfly/base/patternfly-svg-icons.scss`:
- Around line 10-22: The CSS class names use underscores and a non-PatternFly
modifier style (.#{$pf-prefix}icon_rh-ui, .#{$pf-prefix}icons-set_rh-ui,
.#{$pf-prefix}icon_default) which deviates from PF BEM conventions; rename these
to hyphenated, PF modifier-style names (for example .#{$pf-prefix}icon-rh-ui ->
.#{$pf-prefix}icon--rh-ui or .#{$pf-prefix}icon.pf-m-rh-ui, and
.#{$pf-prefix}icons-set_rh-ui -> .#{$pf-prefix}icons-set.pf-m-rh-ui or
.#{$pf-prefix}icons-set--rh-ui, and .#{$pf-prefix}icon_default ->
.#{$pf-prefix}icon--default or .#{$pf-prefix}icon.pf-m-default) and update the
selectors in patternfly-svg-icons.scss (the rules around
.#{$pf-prefix}icon_rh-ui, .#{$pf-prefix}icons-set_rh-ui, and
.#{$pf-prefix}icon_default) accordingly; also search and replace all usages
across the codebase to keep HTML/JS references consistent and run the project's
stylelint/rg checks to ensure naming now matches existing PF patterns (pf-m or
pf-t) and no underscores remain.
- Around line 14-22: Replace the use of display: revert on the
.#{$pf-prefix}icon_rh-ui rule with an explicit display value to avoid unintended
overrides by future cascade rules; update the selector
.#{$pf-prefix}icons-set_rh-ui .#{$pf-prefix}icon_rh-ui to use display: inline
(or another explicit display appropriate for inner <svg> elements) instead of
revert so the nested SVGs render predictably regardless of later stylesheet
changes.

Comment thread src/patternfly/base/patternfly-svg-icons.scss Outdated
Comment thread src/patternfly/base/patternfly-svg-icons.scss Outdated

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

🔥

@mcoker mcoker merged commit 2d2395e into patternfly:main Feb 12, 2026
5 checks passed
@patternfly-build

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 6.5.0-prerelease.41 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Icons: create classes for icon swap feature

3 participants