Skip to content

Size prop inconsistency: Icon, Spinner, and Avatar use same names for different values #2672

Closed

Description

@cixzhang

Problem

Icon, Spinner, and Avatar all have a size prop but their scales are completely independent — same names map to different pixel values:

Name Icon Spinner (⌀) Avatar
xsm 12px — —
sm 16px 10px —
md 20px 14px —
lg 24px 18px —
xl — 28px —
tiny — — 20px
xsmall — — 24px
small — — 36px
medium — — 48px
large — — 128px

size="sm" means 16px on Icon but 10px on Spinner. Meanwhile Avatar's tiny (20px) = Icon's md (20px), and Avatar's xsmall (24px) = Icon's lg (24px).

Overlap points

Icon and Avatar actually share values at the small end:

  • Icon md (20px) = Avatar tiny (20px)
  • Icon lg (24px) = Avatar xsmall (24px)

Impact

  • LLMs generating code must learn three separate size systems
  • Developers composing Icon inside Avatar (or vice versa) can't reason about sizes by name
  • Spinner sizes have no relationship to anything else in the system

Possible directions

  1. Unified visual scale — a single named scale (e.g. tiny/xsmall/small/medium/large/xlarge/2xl) shared by Icon, Spinner, and Avatar, where each component only exposes the subset it supports
  2. Numeric-first for display components — Icon/Spinner/Avatar accept pixel numbers as primary API (Avatar already does), with named presets as convenience aliases
  3. Keep names but align values — make sm/md/lg mean the same pixel values across Icon and Spinner (would be breaking)
  4. Status quo + documentation — accept the divergence, document it clearly

Context

Ran a comparative vibe test (internal/vibe-tests/size-naming-test/) evaluating abbreviated vs full-word naming. Both achieve 100% LLM accuracy when documented. The real issue isn't abbreviation style — it's that the same name means different things across components.

Interactive components (Button, Selector, TabList, etc.) are consistent — they all reference --size-element-sm/md/lg tokens (28/32/36px). The inconsistency is isolated to the three "visual" components: Icon, Spinner, Avatar.

Activity

  1. added
    discussion
    design
    on Jun 11, 2026
  2. cixzhang commented on Jun 12, 2026

    @cixzhang
    ContributorAuthor

    Follow-up from a usage/context audit: the problematic part is less "Avatar has different words" and more that Avatar sizes are often chosen to match adjacent text/media blocks, not control heights.

    Why size={40} shows up

    For the common list/media pattern — body/label text + supporting/subtext — the current typography tokens produce a 40px text block:

    Text line Token math Line box
    body / label 14px × 1.4286 20px
    supporting 12px × 1.6667 20px

    So:

    20px label/body line
    + 0px vertical gap
    + 20px supporting line
    = 40px content block
    

    That explains repeated XDSAvatar size={40} usage in list/media contexts. It is not arbitrary; it exactly matches a two-line label + subtext block.

    Contextual size targets

    Adjacent content pattern Formula Ideal avatar Closest current Avatar options
    body/label + supporting, no gap 20 + 0 + 20 40px small 36px (−4), medium 48px (+8)
    body/label + supporting, gap={0.5} 20 + 2 + 20 42px small 36px (−6), medium 48px (+6)
    body/label + supporting, gap={1} 20 + 4 + 20 44px medium 48px (+4), small 36px (−8)
    compact one-line metadata ~20px 20–24px tiny 20px / xsmall 24px
    one control row 28–32px 28–32px numeric size={28} / size={32}; no named exact option

    Questionable combinations found

    Confidence Current usage Context target Delta Suggested current option
    High Avatar JSDoc example uses size="sm" 24px leading-media/icon slot invalid size="xsmall"
    High Chat list JSDoc example uses size="md" 36px balanced chat avatar invalid size="small"
    Medium Typeahead item showcase uses size="small" = 36px in an icon/leading-media slot 24px +12px size="xsmall"
    Medium Compact-density table uses size="small" = 36px 24px compact identity +12px size="xsmall" if the row should stay compact
    Low Row with Avatar size="small" = 36px adjacent to Button size="sm" = 28px 28px if matching the control +8px size={28} exact, or xsmall closest named

    Most size="small" usages in balanced two-line list/chat contexts look correct: 36px is close to the 40px text block and visually reads well. The missing first-class named option appears to be the 40px list/media avatar, not necessarily a wholesale value change.

    Implication for naming-only work

    If the scope is just naming consistency and not value alignment, we should document clearly that Avatar sizes are Avatar scale tiers, not element/control heights. Otherwise Avatar size="sm" would still be 36px while Button size="sm" is 28px.

    Potential follow-ups:

    1. Fix invalid docs/examples (sm/md on Avatar are currently invalid).
    2. Consider whether Avatar should expose a named 40px tier because it maps exactly to body + supporting text.
    3. Keep xsmall/24px as the guidance for compact table cells and icon-like leading media slots.

    — via Navi

  3. cixzhang commented on Jul 21, 2026

    @cixzhang
    ContributorAuthor

    Decisions

    Avatar adopts Icon's names, keeps its larger values (shipping now)

    Avatar and AvatarGroup rename tiny/xsmall/small/medium/large → xsm/sm/md/lg/xl. Pixel values are unchanged (20/24/36/48/128px). Rationale: avatar sizes are naturally larger because they align with media, not glyphs — so they share Icon's abbreviated vocabulary but at a media-scaled tier set. These tiers also match EPS's avatar sizes. The default moves small → md (same 36px), aligning Avatar's default with Icon's.

    Breaking change, shipped with a v0.1.8 codemod (rename-avatar-size-scale) so astryx upgrade migrates call sites. → #4140

    Spinner: not changing (for now)

    We considered moving Spinner onto Icon's scale but are holding off — leaving Spinner's current sm/md/lg/xl API as-is.

    Where this leaves the scales

    Icon and Avatar now share the xsm/sm/md/lg/xl vocabulary (same names, media-scaled values on Avatar) and both default to md. Spinner keeps its own scale for now.

    name Icon Avatar
    xsm 12 20
    sm 16 24
    md 20 36
    lg 24 48
    xl — 128
  4. cixzhang commented on Sep 2, 2026

    @cixzhang
    ContributorAuthor

    Thanks for framing this so concretely—the size tables made the decision easy to reach. The recorded outcome is now shipped: Avatar adopted Icon's abbreviated xsm / sm / md / lg / xl names in #4140, together with the rename-avatar-size-scale codemod, and its default moved to md. Spinner was deliberately left on its own scale for now, as recorded in the decision above. Closing as resolved; revisiting Spinner or a numeric-first API would be a separate proposal with its own evidence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    designdiscussion

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions