Skip to content

AvatarGroupOverflow: grow to a pill for long counts so "+N" text doesn't clip #4167

Closed

Description

@cixzhang

Summary

The AvatarGroupOverflow "+N" indicator is a fixed-size circle. With larger counts (e.g. +4912) the text is wider than the circle and appears to clip / crowd the edges. For longer content, let the indicator grow horizontally into a pill (stadium shape) so the number always fits with comfortable padding, while short counts (+5) stay a circle.

Current behavior

AvatarGroupOverflow renders at a fixed square size with a full radius:

dynamicStyles.size(s) => { width: s, height: s }   // fixed square
styles.base           => { borderRadius: radiusVars['--radius-full'] }  // → circle

Because width is pinned to the avatar size, a multi-digit +N has nowhere to go and reads as clipped (see before/after below).

Proposed behavior

  • Keep the circle for short content: minimum width = the avatar size (so a single/double-digit +N is a perfect circle, matching the avatars).
  • Let it grow for longer content: switch width: s → minWidth: s (with height: s fixed) and add horizontal padding, so wide content expands the indicator horizontally.
  • Keep borderRadius: --radius-full — at height/2 it renders as a circle when narrow and a stadium/pill when wide, automatically. No shape prop needed.
  • Preserve the existing overlap, border ring, opaque background, and interactive (button) states.

Before → after:

Fixed circle (clips) Pill grows to fit
(+4912) cramped in a circle ( +4912 ) in a stadium/pill

Design notes

  • This is a purely visual/layout change to AvatarGroupOverflow — likely no new public prop (the pill is automatic based on content width). If we want to cap growth, a maxWidth + truncation is a follow-up, not required here.
  • Add horizontal padding via a spacing token so it scales with size; vertical size stays locked to the avatar height so the row stays aligned.
  • Overlap math (marginInlineStart) is unaffected — it keys off the leading edge, which doesn't move.
  • Themeability: the overflow already emits themeProps('avatar-group-overflow'); the pill dimensions should stay token-driven so themes aren't broken.

Acceptance criteria

  • +5 (short) renders as a circle sized to the avatars, unchanged from today.
  • +4912 (long) renders as a horizontally-grown pill with the full number visible and comfortable padding — no clipping/crowding.
  • Row stays vertically aligned with the avatars (height unchanged).
  • Overlap, border ring, opaque background, and hover/active/focus (button variant) states all preserved.
  • Renders correctly across themes + light/dark.
  • Custom children content (not just +N) also grows to fit.

Notes

Activity

  1. self-assigned this
    on Jul 22, 2026
  2. added
    hardening
    on Jul 22, 2026
  3. added a commit that references this issue on Jul 22, 2026
    7a28722
  4. added a commit that references this issue on Jul 22, 2026
    1055df2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

hardening

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions