feat(Avatar): allow circle, rounded, or square shape options#4212
Open
saadpocalypse wants to merge 1 commit into
Open
feat(Avatar): allow circle, rounded, or square shape options#4212saadpocalypse wants to merge 1 commit into
saadpocalypse wants to merge 1 commit into
Conversation
saadpocalypse
requested review from
cixzhang,
ejhammond,
imdreamrunner and
josephfarina
as code owners
July 22, 2026 20:33
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
github-actions
Bot
requested review from
cvkxx,
ernestt,
kentonquatman and
rubyycheung
July 22, 2026 20:33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Currently, the
Avatarcomponent is always a full circle, and there is no supported way to make it square or rounded-square. Overriding--radius-fullin a theme squares everything round (badges, status dots, spinners, etc.) rather than just avatars.This pull request introduces a new
shapeprop (circle|rounded|square) to theAvatarcomponent, defaulting tocircle. The shape is fully token-driven by a new--radius-avatardesign token, allowing themes to set the shape globally (e.g., "all avatars in this app are rounded-square") rather than per instance.Proposed Changes
Design Token Integration
--radius-avatar(defaulting to9999px) inradiusDefaults.--radius-avatarto theexpandRadiusScaleutility.Avatar Shape Control
shapeprop toAvatarProps.--radius-avatar:circle→--radius-fullrounded→--radius-elementsquare→0px(strictly sharp corners)Status Dot Placement
Implemented a unified CSS positioning formula for the status indicator using
calc()andmin():This automatically positions the status dot correctly for any value of
--radius-avatar, whether the avatar is circular, rounded, or square.Group & Overflow Support
AvatarGroupOverflowto use--radius-avatar.--radius-avatar, ensuring consistent shapes throughout avatar groups.Documentation Updates
shapeprop inAvatar.doc.mjs.Testing & Stories
Avatar.test.tsxexpandRadiusScale.test.tsVerification
pnpm test Avatarandpnpm test expandRadiusScale; all tests passed.to verify successful StyleX and TypeScript compilation.
Resolves
Closes #4205