Skip to content

feat(icon): apply rh-standard styling and add opt-out#12320

Open
kmcfaul wants to merge 2 commits intopatternfly:mainfrom
kmcfaul:rh-standard-icon-styling
Open

feat(icon): apply rh-standard styling and add opt-out#12320
kmcfaul wants to merge 2 commits intopatternfly:mainfrom
kmcfaul:rh-standard-icon-styling

Conversation

@kmcfaul
Copy link
Copy Markdown
Contributor

@kmcfaul kmcfaul commented Apr 6, 2026

What: Closes #12321

  • Bumps core version for new class
  • Automatically applies class for all standard icons
  • Adds noStandardSetStyling to opt out of applying the class

Summary by CodeRabbit

  • New Features

    • Icon components now support customizable standard styling behavior via a new optional prop.
  • Chores

    • Updated PatternFly design system dependency to prerelease 65 across all packages.

@kmcfaul kmcfaul changed the title feat(icon): add rh-standard set classname & opt-out feat(icon): apply rh-standard styling and add opt-out Apr 6, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 6, 2026

Walkthrough

The PR updates the PatternFly CSS dependency to version 6.5.0-prerelease.65 across multiple packages and introduces an optional noStandardSetStyling prop to SVGIconProps to conditionally control application of the pf-v6-icon-rh-standard CSS class in icon rendering.

Changes

Cohort / File(s) Summary
PatternFly Dependency Updates
packages/react-core/package.json, packages/react-docs/package.json, packages/react-icons/package.json, packages/react-styles/package.json, packages/react-tokens/package.json
Updated @patternfly/patternfly devDependency version from 6.5.0-prerelease.62 to 6.5.0-prerelease.65 across all packages.
Icon Rendering Logic
packages/react-icons/src/createIcon.tsx
Added optional noStandardSetStyling prop to SVGIconProps interface. Implemented conditional logic to apply the pf-v6-icon-rh-standard CSS class only when this prop is falsy, with a default value of false.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • PR #12245: Modifies packages/react-icons/src/createIcon.tsx to change icon rendering and CSS class handling through prop-based control.

Suggested reviewers

  • nicolethoen
  • thatblindgeye
  • wise-king-sullyman
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(icon): apply rh-standard styling and add opt-out' accurately reflects the main change in the pull request—adding RH-standard styling to icons and introducing an opt-out mechanism via the new noStandardSetStyling prop.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@patternfly-build
Copy link
Copy Markdown
Collaborator

patternfly-build commented Apr 6, 2026

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/react-icons/src/createIcon.tsx (1)

100-114: ⚠️ Potential issue | 🟠 Major

Opt-out is not applied in the dual-render path.

noStandardSetStyling is only respected in the single-icon branch (Lines 107-114). In the dual-render branch (Lines 155-156), createSvg(...) still unconditionally appends svgClassName, so pf-v6-icon-rh-standard can still render even when opt-out is true.

💡 Proposed fix
-const createSvg = (icon: IconDefinition, iconClassName: string) => {
+const createSvg = (icon: IconDefinition, iconClassName: string, noStandardSetStyling = false) => {
   const { xOffset, yOffset, width, height, svgPathData, svgClassName } = icon ?? {};
@@
-  if (svgClassName) {
+  if (svgClassName && !(noStandardSetStyling && svgClassName === 'pf-v6-icon-rh-standard')) {
     classNames.push(svgClassName);
   }
@@
-        if (svgClassName) {
-          if (svgClassName !== 'pf-v6-icon-rh-standard') {
-            classNames.push(svgClassName);
-          } else {
-            if (!noStandardSetStyling) {
-              classNames.push(svgClassName);
-            }
-          }
-        }
+        if (svgClassName && !(noStandardSetStyling && svgClassName === 'pf-v6-icon-rh-standard')) {
+          classNames.push(svgClassName);
+        }
@@
-            {icon && createSvg(icon, 'pf-v6-icon-default')}
-            {rhUiIcon && createSvg(rhUiIcon, 'pf-v6-icon-rh-ui')}
+            {icon && createSvg(icon, 'pf-v6-icon-default', noStandardSetStyling)}
+            {rhUiIcon && createSvg(rhUiIcon, 'pf-v6-icon-rh-ui', noStandardSetStyling)}

Also applies to: 143-157

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/react-icons/src/createIcon.tsx` around lines 100 - 114, The
dual-render path is appending svgClassName unconditionally when calling
createSvg, so the opt-out flag noStandardSetStyling isn't respected and
pf-v6-icon-rh-standard can still be applied; update the dual-render branch in
createIcon/createSvg usage to mirror the single-icon logic: when svgClassName is
defined, only push it to the class list if it's not 'pf-v6-icon-rh-standard' or
if noStandardSetStyling is false (i.e., skip adding that specific class when
noStandardSetStyling is true), ensuring the same conditional handling of
svgClassName used for the single-icon branch (referencing svgClassName,
noStandardSetStyling, createSvg, and iconData/rhUiIcon).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@packages/react-icons/src/createIcon.tsx`:
- Around line 100-114: The dual-render path is appending svgClassName
unconditionally when calling createSvg, so the opt-out flag noStandardSetStyling
isn't respected and pf-v6-icon-rh-standard can still be applied; update the
dual-render branch in createIcon/createSvg usage to mirror the single-icon
logic: when svgClassName is defined, only push it to the class list if it's not
'pf-v6-icon-rh-standard' or if noStandardSetStyling is false (i.e., skip adding
that specific class when noStandardSetStyling is true), ensuring the same
conditional handling of svgClassName used for the single-icon branch
(referencing svgClassName, noStandardSetStyling, createSvg, and
iconData/rhUiIcon).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3406e8bd-ce94-4431-9d2e-d539acf6d03d

📥 Commits

Reviewing files that changed from the base of the PR and between a7a847c and 278cbbe.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (7)
  • packages/react-core/package.json
  • packages/react-docs/package.json
  • packages/react-icons/package.json
  • packages/react-icons/scripts/icons/rhIconsStandard.mjs
  • packages/react-icons/src/createIcon.tsx
  • packages/react-styles/package.json
  • packages/react-tokens/package.json

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.

Icon - apply rhds standard icon variant

2 participants