Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Avatar] Fix AvatarGroup sizing, wire up disabled prop, and forward Base UI props

未关闭
#597 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
react, typescript
领域
design, frontend

调研方向

从 Avatar 和 AvatarGroup 的实现开始,包括它们的 CVA 配置和递归的 getAvatarProps 逻辑。跟踪 Base UI 如何暴露 image 和 fallback props,然后验证尺寸设置、禁用样式、prop 转发、稳健的子元素提取以及稳定的 avatar reconciliation 是否都如描述般正常工作。

由索引模型根据 Issue 内容生成。

描述

component triage

Summary

Improvements to the Avatar component to fix bugs, forward missing Base UI props, and improve AvatarGroup reliability.

API Differences from Base UI

Base UI Apsara Change
Avatar.Root Avatar Flattened — root is the default
Avatar.Image (none) Hidden inside Avatar, exposed via src/alt props
Avatar.Fallback (none) Hidden inside Avatar, exposed via fallback prop
(none) AvatarGroup Custom addition
(none) getAvatarColor Custom utility
Props not forwarded from Base UI
  • Image: onLoadingStatusChange — callback for tracking image load/error state
  • Fallback: delay — delay before showing fallback (avoids flash for fast-loading images)

Improvements

1. Fix AvatarGroup overlap CSS (size selectors don't match)

The CSS defines .avatar-size-N .avatarWrapper selectors, but AvatarGroup renders a plain <div> — the size classes are on individual avatars inside .avatarWrapper, not on a parent, so the overlap selectors never match.

2. Wire up disabled prop to CVA

The CVA config has disabled: { true: styles['avatar-disabled'] } but AvatarProps doesn't include disabled as a prop — it's never passed to the CVA call.

3. Forward onLoadingStatusChange from Image

Base UI's Avatar.Image supports onLoadingStatusChange for tracking image load/error state. Currently not exposed.

4. Forward delay from Fallback

Base UI supports a delay prop on Avatar.Fallback to avoid a flash when the image loads quickly. Currently not exposed.

5. Improve getAvatarProps robustness

The recursive prop extraction only works if the direct child is an Avatar or has a single children prop. Wrapping in Tooltip or other components with different prop structures may fail silently.

6. Fix array index key in AvatarGroup

avatars.map((avatar, index) => <div key={index}> — if the avatar list changes order, React won't reconcile correctly.

主要语言
TypeScript
星标
70
派生
13
平均合并
8 天 56 分钟
30 天内合并 PR
16

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

raystack/apsara 的其他 Issue

查看 raystack/apsara 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。