Skip to content

feat(avatar): add support for icons#8454

Merged
thatblindgeye merged 9 commits into
patternfly:mainfrom
mcoker:avatar-icon-support
Jun 18, 2026
Merged

feat(avatar): add support for icons#8454
thatblindgeye merged 9 commits into
patternfly:mainfrom
mcoker:avatar-icon-support

Conversation

@mcoker

@mcoker mcoker commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

fixes #8456

Summary by CodeRabbit

  • New Features
    • Avatar component now supports image-based rendering with configurable source and alt text, plus improved non-image rendering/accessibility behavior (initials, icons, and fallbacks).
    • Added colorful avatar styling with expanded color variants.
    • Added/updated size variations for avatars.
  • Documentation
    • Refreshed Avatar examples, including new image/non-image usage patterns and updated accessibility guidance.
    • Updated related demo examples to use the new avatar image configuration.
  • Refactor
    • Restructured avatar color modifier implementation and updated avatar styling variables for consistent sizing and colors.

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

The Avatar component is refactored to conditionally render either a <div> or <img> element based on a new avatar--IsImg flag. The avatar--colorful partial is removed; colorful variants are now handled directly in avatar.hbs via avatar--IsColorful and per-color boolean flags. New avatar--colors.hbs and avatar--sizes.hbs partials are added, a readFile Handlebars helper is introduced, SCSS color modifiers are restructured into individual top-level blocks, and MenuToggle/Compass header consumers adopt avatar--IsImg.

Changes

Avatar Template Refactor and Component Updates

Layer / File(s) Summary
readFile Handlebars build helper
scripts/helpers.mjs
Exports a new readFile helper that resolves and reads a file path relative to the project root, returns its UTF-8 contents as a Handlebars.SafeString, and returns a safe HTML error comment on failures.
Conditional img/div avatar rendering in core template
src/patternfly/components/Avatar/avatar.hbs
Adds an avatar--IsImg branch rendering an <img> with setModifiers, alt, and src. The non-img branch renders a <div> with role="img", color/size/border modifiers, conditional aria-label/aria-hidden, and inner content routed by priority: initials span, readFile SVG, pfIcon, partial block, or inline SVG fallback. Removes the old avatar--colorful.hbs partial.
Avatar SCSS: font sizes, div layout, and per-color modifiers
src/patternfly/components/Avatar/avatar.scss
Adds computed --FontSize variables for base and all size variants. Expands the main selector with --Color, --BackgroundColor, border styling, and an @at-root div#{&} rule with inline-flex layout. Replaces nested pf-m-colorful per-color wiring with individual top-level pf-m-{color} blocks.
New avatar--colors and avatar--sizes partials
src/patternfly/components/Avatar/avatar--colors.hbs, src/patternfly/components/Avatar/avatar--sizes.hbs
Adds avatar--colors.hbs with nine partial calls for Red through Gray using avatar--IsColorful=true and per-color flags. Adds avatar--sizes.hbs with four size-specific renderings combining image and red colorful variants.
Avatar examples, docs, and example container styles
src/patternfly/components/Avatar/examples/Avatar.md, src/patternfly/components/Avatar/examples/Avatar.css
Rewrites example blocks to use avatar--IsImg, avatar--colors partial, and avatar--IsColorful=true boolean props. Updates the Usage table selector from .pf-v6-c-avatar--colorful to .pf-m-colorful. Adds a flex/wrap/gap example container stylesheet rule.
MenuToggle and Compass header avatar--IsImg adoption
src/patternfly/components/MenuToggle/examples/MenuToggle.md, src/patternfly/demos/Compass/compass--header.hbs
Passes avatar--IsImg alongside existing modifiers in MenuToggle "With avatar and text" examples (default, expanded, disabled) and the Compass header profile menu.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • patternfly/patternfly#8147: The main PR's updated Avatar template relies on the pfIcon helper for avatar--icon rendering, and this retrieved PR adds that missing pfIcon Handlebars helper.
  • patternfly/patternfly#8421: Introduced avatar--colorful.hbs and the original pf-m-colorful SCSS logic that this PR removes and replaces with per-color top-level modifier blocks.
  • patternfly/patternfly#8452: Touches avatar.scss in the pf-m-colorful modifier area, which overlaps directly with this PR's restructuring of color modifier blocks.

Suggested labels

released on @prerelease``, Needs design review

Suggested reviewers

  • andrew-ronaldson
  • thatblindgeye
  • kmcfaul
  • jcmill
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(avatar): add support for icons' follows conventional commit guidelines with a 'feat' type, scoped to 'avatar', but only partially reflects the changeset which includes icon support plus broader avatar restructuring (image mode, colorful modifiers, initials rendering, new helpers).
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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


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

patternfly-build commented Jun 15, 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: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/patternfly/components/Avatar/avatar.hbs`:
- Around line 1-31: The logic flow is broken for both avatar--src and
avatar--IsColorful cases. In the div branch, the avatar--src condition renders a
hardcoded inline SVG instead of using the provided avatar--src URL as an image
source. Additionally, the avatar--IsColorful modifier is only applied to the div
branch but not to the img fallback, which means the colorful modifier is lost in
the fallback path. Fix this by replacing the hardcoded SVG at lines 18-22 with
an img tag that uses avatar--src as the src attribute, and restructure the
conditional logic so that the avatar--IsColorful modifier is applied to both the
div branch (for initials/icons/partial-block) and the img fallback branch.
Ensure both rendering paths properly handle the avatar--src URL and the colorful
styling.

In `@src/patternfly/components/Avatar/examples/Avatar.md`:
- Line 102: In the Avatar usage table at the specified location, the "Class"
column entry contains the template parameter `avatar--IsColorful=true`, which is
not a CSS class selector. Replace this entry with the actual emitted CSS class
(such as `.pf-m-colorful` or `.pf-v6-c-avatar.pf-m-colorful`) that results from
using that template parameter. If needed, document the template API parameter
usage separately outside the CSS class table to maintain clear separation
between template parameters and actual CSS selectors.
- Around line 73-83: The introductory sentence and all aria-label attributes in
the colorful avatar examples are incorrectly referencing "initial" when they
should reference "icon" since these examples use the rh-ui-ai-chatbot icon.
Update the sentence at the beginning to describe these as icon-based avatars,
and replace "initial" with "icon" in all nine avatar--aria-label attributes to
accurately reflect that assistive technology users are seeing an icon, not a
user initial.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 215ca12d-4ba5-4d43-9269-55b976da9a73

📥 Commits

Reviewing files that changed from the base of the PR and between 9c07bb8 and 4381c3a.

📒 Files selected for processing (2)
  • src/patternfly/components/Avatar/avatar.hbs
  • src/patternfly/components/Avatar/examples/Avatar.md

Comment on lines +1 to +31
{{#ifAny avatar--initials avatar--icon @partial-block avatar--src}}
<div class="{{pfv}}avatar
{{setModifiers
avatar--IsColorful='pf-m-colorful'
avatar--modifier=avatar--modifier
}}"
{{#if avatar--attribute}}
{{{avatar--attribute}}}
{{/if}}
role="img"
{{#if avatar--aria-label}}aria-label="{{avatar--aria-label}}"{{else}}aria-hidden="true"{{/if}}>
{{#if avatar--initials}}
<span class="{{pfv}}avatar__initials" aria-hidden="true">{{avatar--initials}}</span>
{{else if avatar--icon}}
{{ pfIcon icon=avatar--icon}}
{{else if @partial-block}}
{{> @partial-block}}
{{else if avatar--src}}
<svg aria-hidden="true" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 36 36">
<path fill="currentColor" d="M17.7,20.1c-3.5,0-6.4-2.9-6.4-6.4s2.9-6.4,6.4-6.4,6.4,2.9,6.4,6.4-2.8,6.4-6.4,6.4Z"/>
<path fill="currentColor" d="M30.6,36c-.4-3.9-1.3-9-2.9-11-1.1-1.4-2.3-2.2-3.5-2.6s-1.8-.6-6.3-.6-6.1.7-6.1.7c-1.2.4-2.4,1.2-3.4,2.6-1.7,1.9-2.6,7.1-3,10.9h25.2Z"/>
</svg>
{{/if}}
</div>
{{else}}
<img class="{{pfv}}avatar
{{setModifiers
avatar--modifier=avatar--modifier
}}"
alt="{{#if avatar--alt}}{{avatar--alt}}{{else}}{{/if}}"
src="/assets/images/img_avatar-light.svg"

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

avatar--src and avatar--IsColorful branching currently breaks both custom-image and colorful-default flows.

The ifAny gate uses avatar--src (Line 1), but the div branch never uses that URL as an image source and instead renders inline SVG (Lines 18-22). Meanwhile, the img fallback always uses the hardcoded default src (Line 31) and does not include the colorful modifier path. This conflicts with the updated examples and will render incorrect output for both avatar--src and avatar--IsColorful=true cases.

Proposed fix
-{{`#ifAny` avatar--initials avatar--icon `@partial-block` avatar--src}}
+{{`#ifAny` avatar--initials avatar--icon `@partial-block` avatar--IsColorful}}
   <div class="{{pfv}}avatar
     {{setModifiers
       avatar--IsColorful='pf-m-colorful'
       avatar--modifier=avatar--modifier
     }}"
@@
-    {{else if avatar--src}}
+    {{else}}
       <svg aria-hidden="true" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 36 36">
         <path fill="currentColor" d="M17.7,20.1c-3.5,0-6.4-2.9-6.4-6.4s2.9-6.4,6.4-6.4,6.4,2.9,6.4,6.4-2.8,6.4-6.4,6.4Z"/>
         <path fill="currentColor" d="M30.6,36c-.4-3.9-1.3-9-2.9-11-1.1-1.4-2.3-2.2-3.5-2.6s-1.8-.6-6.3-.6-6.1.7-6.1.7c-1.2.4-2.4,1.2-3.4,2.6-1.7,1.9-2.6,7.1-3,10.9h25.2Z"/>
       </svg>
@@
-    src="/assets/images/img_avatar-light.svg"
+    src="{{`#if` avatar--src}}{{avatar--src}}{{else}}/assets/images/img_avatar-light.svg{{/if}}"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{{#ifAny avatar--initials avatar--icon @partial-block avatar--src}}
<div class="{{pfv}}avatar
{{setModifiers
avatar--IsColorful='pf-m-colorful'
avatar--modifier=avatar--modifier
}}"
{{#if avatar--attribute}}
{{{avatar--attribute}}}
{{/if}}
role="img"
{{#if avatar--aria-label}}aria-label="{{avatar--aria-label}}"{{else}}aria-hidden="true"{{/if}}>
{{#if avatar--initials}}
<span class="{{pfv}}avatar__initials" aria-hidden="true">{{avatar--initials}}</span>
{{else if avatar--icon}}
{{ pfIcon icon=avatar--icon}}
{{else if @partial-block}}
{{> @partial-block}}
{{else if avatar--src}}
<svg aria-hidden="true" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 36 36">
<path fill="currentColor" d="M17.7,20.1c-3.5,0-6.4-2.9-6.4-6.4s2.9-6.4,6.4-6.4,6.4,2.9,6.4,6.4-2.8,6.4-6.4,6.4Z"/>
<path fill="currentColor" d="M30.6,36c-.4-3.9-1.3-9-2.9-11-1.1-1.4-2.3-2.2-3.5-2.6s-1.8-.6-6.3-.6-6.1.7-6.1.7c-1.2.4-2.4,1.2-3.4,2.6-1.7,1.9-2.6,7.1-3,10.9h25.2Z"/>
</svg>
{{/if}}
</div>
{{else}}
<img class="{{pfv}}avatar
{{setModifiers
avatar--modifier=avatar--modifier
}}"
alt="{{#if avatar--alt}}{{avatar--alt}}{{else}}{{/if}}"
src="/assets/images/img_avatar-light.svg"
{{`#ifAny` avatar--initials avatar--icon `@partial-block` avatar--IsColorful}}
<div class="{{pfv}}avatar
{{setModifiers
avatar--IsColorful='pf-m-colorful'
avatar--modifier=avatar--modifier
}}"
{{`#if` avatar--attribute}}
{{{avatar--attribute}}}
{{/if}}
role="img"
{{`#if` avatar--aria-label}}aria-label="{{avatar--aria-label}}"{{else}}aria-hidden="true"{{/if}}>
{{`#if` avatar--initials}}
<span class="{{pfv}}avatar__initials" aria-hidden="true">{{avatar--initials}}</span>
{{else if avatar--icon}}
{{ pfIcon icon=avatar--icon}}
{{else if `@partial-block`}}
{{> `@partial-block`}}
{{else}}
<svg aria-hidden="true" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 36 36">
<path fill="currentColor" d="M17.7,20.1c-3.5,0-6.4-2.9-6.4-6.4s2.9-6.4,6.4-6.4,6.4,2.9,6.4,6.4-2.8,6.4-6.4,6.4Z"/>
<path fill="currentColor" d="M30.6,36c-.4-3.9-1.3-9-2.9-11-1.1-1.4-2.3-2.2-3.5-2.6s-1.8-.6-6.3-.6-6.1.7-6.1.7c-1.2.4-2.4,1.2-3.4,2.6-1.7,1.9-2.6,7.1-3,10.9h25.2Z"/>
</svg>
{{/if}}
</div>
{{else}}
<img class="{{pfv}}avatar
{{setModifiers
avatar--modifier=avatar--modifier
}}"
alt="{{`#if` avatar--alt}}{{avatar--alt}}{{else}}{{/if}}"
src="{{`#if` avatar--src}}{{avatar--src}}{{else}}/assets/images/img_avatar-light.svg{{/if}}"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/patternfly/components/Avatar/avatar.hbs` around lines 1 - 31, The logic
flow is broken for both avatar--src and avatar--IsColorful cases. In the div
branch, the avatar--src condition renders a hardcoded inline SVG instead of
using the provided avatar--src URL as an image source. Additionally, the
avatar--IsColorful modifier is only applied to the div branch but not to the img
fallback, which means the colorful modifier is lost in the fallback path. Fix
this by replacing the hardcoded SVG at lines 18-22 with an img tag that uses
avatar--src as the src attribute, and restructure the conditional logic so that
the avatar--IsColorful modifier is applied to both the div branch (for
initials/icons/partial-block) and the img fallback branch. Ensure both rendering
paths properly handle the avatar--src URL and the colorful styling.

Comment thread src/patternfly/components/Avatar/examples/Avatar.md Outdated
Comment thread src/patternfly/components/Avatar/examples/Avatar.md Outdated

@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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/patternfly/components/MenuToggle/examples/MenuToggle.md`:
- Line 293: The `avatar--IsImg` parameter in the handlebars template helper is
being passed as a bare positional token instead of as an explicit hash
parameter, causing it to evaluate as undefined and fail the conditional check in
the Avatar component. Change all three occurrences of the handlebars helper
invocations to use `avatar--IsImg=true` instead of `avatar--IsImg` as a
positional token (at lines 293, 307, and 321 in the MenuToggle.md file) to
explicitly set the hash parameter and ensure the avatar renders as an image
rather than falling back to the initials/icon branch.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 79002174-2c43-46ca-a85b-67bb3ddfdf0a

📥 Commits

Reviewing files that changed from the base of the PR and between 4381c3a and 07d8733.

📒 Files selected for processing (5)
  • src/patternfly/components/Avatar/avatar--colorful.hbs
  • src/patternfly/components/Avatar/avatar.hbs
  • src/patternfly/components/Avatar/examples/Avatar.md
  • src/patternfly/components/MenuToggle/examples/MenuToggle.md
  • src/patternfly/demos/Compass/compass--header.hbs
💤 Files with no reviewable changes (1)
  • src/patternfly/components/Avatar/avatar--colorful.hbs
✅ Files skipped from review due to trivial changes (1)
  • src/patternfly/demos/Compass/compass--header.hbs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/patternfly/components/Avatar/examples/Avatar.md

Comment thread src/patternfly/components/MenuToggle/examples/MenuToggle.md
@mcoker mcoker force-pushed the avatar-icon-support branch from 07d8733 to 500494a Compare June 17, 2026 02:44
@thatblindgeye thatblindgeye marked this pull request as draft June 17, 2026 15:32
@mcoker mcoker marked this pull request as ready for review June 17, 2026 20:09

@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

🧹 Nitpick comments (1)
src/patternfly/components/Avatar/examples/Avatar.md (1)

39-44: 💤 Low value

Remove extraneous wrapper properties that don't cascade to child partials.

The avatar--IsColorful=true and avatar--IsRed=true properties on the wrapper block partial don't propagate to the child avatar partials inside; each avatar explicitly specifies its own size and properties. The wrapper properties are dead code and should be removed for clarity.

🧹 Proposed cleanup
-{{#> wrapper avatar--IsColorful=true avatar--IsRed=true}}
+{{#> wrapper}}
   {{> avatar avatar--IsSmall=true avatar--initials="C" avatar--aria-label="Small red avatar with initial C"}}
   {{> avatar avatar--IsMedium=true avatar--initials="C" avatar--aria-label="Medium red avatar with initial C"}}
   {{> avatar avatar--IsLarge=true avatar--initials="C" avatar--aria-label="Large red avatar with initial C"}}
   {{> avatar avatar--IsXLarge=true avatar--initials="C" avatar--aria-label="Extra large red avatar with initial C"}}
 {{/wrapper}}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/patternfly/components/Avatar/examples/Avatar.md` around lines 39 - 44,
The wrapper block in the Avatar example contains extraneous properties
avatar--IsColorful=true and avatar--IsRed=true that do not cascade to the child
avatar partials and are therefore dead code. Remove these unused properties from
the wrapper opening tag while keeping the wrapper itself intact, since the child
avatar partials already explicitly specify all their own size and styling
properties through their individual attributes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/helpers.mjs`:
- Around line 438-444: The path resolution logic in the conditional block
(checking if filePath starts with '/') is vulnerable to path traversal attacks
because path.join() normalizes but doesn't prevent escape sequences like '..'.
After constructing the resolvedPath using path.join() in both branches, add
validation to ensure the final resolved path stays within its intended directory
boundary. For the first branch where filePath starts with '/', verify the
resolvedPath stays within the 'src/patternfly' directory. For the second branch,
verify it stays within projectRoot. Use path.relative() and check that the
relative path doesn't start with '..' to confirm the resolved path hasn't
escaped the intended boundary, similar to the defensive pattern already used in
the pfIcon helper.

In `@src/patternfly/components/Avatar/examples/Avatar.md`:
- Line 14: Fix the typo in the avatar component attribute where
`avatar--arial-label` is incorrectly spelled. Change it to `avatar--aria-label`
to ensure the accessibility label attribute is properly recognized and applied
to the avatar component.

---

Nitpick comments:
In `@src/patternfly/components/Avatar/examples/Avatar.md`:
- Around line 39-44: The wrapper block in the Avatar example contains extraneous
properties avatar--IsColorful=true and avatar--IsRed=true that do not cascade to
the child avatar partials and are therefore dead code. Remove these unused
properties from the wrapper opening tag while keeping the wrapper itself intact,
since the child avatar partials already explicitly specify all their own size
and styling properties through their individual attributes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 49de3efd-0446-4de7-b86c-130c4d3906ed

📥 Commits

Reviewing files that changed from the base of the PR and between 500494a and b0d099d.

⛔ Files ignored due to path filters (1)
  • src/patternfly/assets/images/pf-logo-avatar.jpg is excluded by !**/*.jpg
📒 Files selected for processing (5)
  • scripts/helpers.mjs
  • src/patternfly/components/Avatar/avatar--colors.hbs
  • src/patternfly/components/Avatar/avatar.hbs
  • src/patternfly/components/Avatar/examples/Avatar.css
  • src/patternfly/components/Avatar/examples/Avatar.md
✅ Files skipped from review due to trivial changes (2)
  • src/patternfly/components/Avatar/examples/Avatar.css
  • src/patternfly/components/Avatar/avatar--colors.hbs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/patternfly/components/Avatar/avatar.hbs

Comment thread scripts/helpers.mjs
Comment thread src/patternfly/components/Avatar/examples/Avatar.md Outdated
@mcoker mcoker requested review from jcmill and thatblindgeye June 17, 2026 21:18

@thatblindgeye thatblindgeye 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. Wondering if the suggestion from coderabbit above would be worth including. Alternatively, if the new helper's purpose is really just scoped to using SVG files inline in core, we could just instead manually do it by copy+pasting the actual svg code into examples (right click the svg file > "open with" > "Text editor").

I guess it's a question of whether doing that is more or less time consuming/tedious/etc than having to pass in the file path to the svg.

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

Looks great! Just a few nits of trailing spaces. 👤

Comment thread src/patternfly/components/Avatar/avatar--colors.hbs Outdated
Comment thread src/patternfly/components/Avatar/avatar--sizes.hbs
Comment thread src/patternfly/components/Avatar/avatar.hbs
@mcoker

mcoker commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

Alternatively, if the new helper's purpose is really just scoped to using SVG files inline in core, we could just instead manually do it by copy+pasting the actual svg code into examples

@thatblindgeye yeah, that's what we do currently. It's fine if we use an SVG/image once, but if we use it multiple times especially across multiple components/examples, it's not ideal. We then either need to put the icon in a handlebars file so we can reference it in different examples (but we can't use that in <img src=""> or background-image: url()), or have multiple copies of it pasted across examples (which is a pain to maintain). This lets us keep 1 image and use it inline in hbs, or in <img>/background-image. I like it but I'm not married to it if others think it's confusing or a pain.

mcoker and others added 2 commits June 18, 2026 09:47
@thatblindgeye thatblindgeye merged commit 5649cea into patternfly:main Jun 18, 2026
6 checks passed
@patternfly-build

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 6.6.0-prerelease.9 🎉

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.

Bug - Avatar - update to support icons

4 participants