Skip to content

Add variant & shape props to AvatarStack component #6420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Aug 5, 2025

Conversation

chanakyav
Copy link
Contributor

@chanakyav chanakyav commented Jul 30, 2025

Note

Changelog

Added/Changed

This PR adds new functionality to the AvatarStack component through 2 new props: variant & shape

  • variant - Options: cascade (default) & stacked. Cascade will retain the existing functionality with respect to spacing and opacity. The stacked option will more evenly space out the avatars and remove the opacity for them.
  • shape - Options: circle (default) & square. The new square option will render the avatars as squares by passing the square prop down to the avatar children components.

AvatarStack with shape='circle' and varying avatar counts, and alignments:

Screen.Recording.2025-08-04.at.10.50.15.AM.mov

AvatarStack with shape='square' and varying avatar counts, and alignments:

Screen.Recording.2025-08-04.at.10.52.00.AM.mov

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

Merge checklist

Copy link

changeset-bot bot commented Jul 30, 2025

🦋 Changeset detected

Latest commit: ac76175

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks!

@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Jul 30, 2025
Copy link
Contributor

github-actions bot commented Jul 30, 2025

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 90.25 KB (+0.15% 🔺)
packages/react/dist/browser.umd.js 90.48 KB (+0.07% 🔺)

* Select between `cascade` (default) and `stack`
* Keep existing functionality as default and move new changes to be part of `stack` variant
@github-actions github-actions bot requested a deployment to storybook-preview-6420 August 4, 2025 13:53 Abandoned
@chanakyav chanakyav changed the title Dynamically & evenly space AvatarStack and remove opacity Add variant & shape props to AvatarStack component to control spacing/opacity and shape for avatars Aug 4, 2025
@chanakyav chanakyav changed the title Add variant & shape props to AvatarStack component to control spacing/opacity and shape for avatars Add variant & shape props to AvatarStack component Aug 4, 2025
@github-actions github-actions bot temporarily deployed to storybook-preview-6420 August 4, 2025 14:05 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-6420 August 4, 2025 19:14 Inactive
@chanakyav chanakyav marked this pull request as ready for review August 5, 2025 14:43
@Copilot Copilot AI review requested due to automatic review settings August 5, 2025 14:43
@chanakyav chanakyav requested review from a team as code owners August 5, 2025 14:43
@chanakyav chanakyav requested a review from mperrotti August 5, 2025 14:43
@chanakyav
Copy link
Contributor Author

👋🏽 Hello, reviewers!

Its my first primer/react PR so I'm looking for some guidance on updating docs/storybook examples. I have quite a few examples as you can see in the PR description. Please let me know what places these examples need to go in the storybook and any other docs:

Screenshot 2025-08-05 at 10 40 35 AM

The current features list has a tab for each variation, with these new additions I wanted to double check the structure we want to go for before adding more to the list vs. combining features based on variant type and have less tabs.

Thanks!

Copy link
Contributor

github-actions bot commented Aug 5, 2025

Uh oh! @chanakyav, at least one image you shared is missing helpful alt text. Check #6420 (comment) to fix the following violations:

  • Images should have meaningful alternative text (alt text) at line 5

Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.

Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.

🤖 Beep boop! This comment was added automatically by github/accessibility-alt-text-bot.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds variant and shape customization options to the AvatarStack component to provide more flexible rendering styles.

Key changes:

  • Added variant prop with options cascade (default) and stacked for different avatar spacing and opacity behaviors
  • Added shape prop with options circle (default) and square to control avatar shape rendering
  • Updated CSS to support the new variant and shape combinations with appropriate styling rules

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
AvatarStack.tsx Added new props and logic to pass shape to child avatars
AvatarStack.module.css Extensive CSS updates for variant/shape combinations and styling rules
AvatarStack.test.tsx.snap Updated snapshot to reflect new CSS classes and data attributes
Popover/__snapshots__/Popover.test.tsx.snap Removed all snapshot content (unrelated to PR purpose)
Link/__tests__/__snapshots__/Link.test.tsx.snap Removed all snapshot content (unrelated to PR purpose)

@lukasoppermann
Copy link
Contributor

Please inform me when this gets merged so we can update the Figma component as well.

@chanakyav chanakyav added this pull request to the merge queue Aug 5, 2025
@chanakyav chanakyav removed this pull request from the merge queue due to a manual request Aug 5, 2025
@chanakyav chanakyav added this pull request to the merge queue Aug 5, 2025
Merged via the queue into main with commit 024b82a Aug 5, 2025
43 checks passed
@chanakyav chanakyav deleted the chanakyav/evenly-spaced-avatarstack branch August 5, 2025 18:30
@primer primer bot mentioned this pull request Aug 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants