Skip to content

feat(react-avatar): expose base hooks and types for Avatar components#35899

Open
dmytrokirpa wants to merge 7 commits intomicrosoft:masterfrom
dmytrokirpa:feat/react-avatar-expose-base-hooks
Open

feat(react-avatar): expose base hooks and types for Avatar components#35899
dmytrokirpa wants to merge 7 commits intomicrosoft:masterfrom
dmytrokirpa:feat/react-avatar-expose-base-hooks

Conversation

@dmytrokirpa
Copy link
Copy Markdown
Contributor

Summary

  • Enables useAvatarBase_unstable hook that was already implemented in useAvatar.tsx but gated behind a comment in index.ts
  • Exports AvatarBaseProps and AvatarBaseState types from the package index.ts
  • The base hook manages slot structure (root, initials, icon, image slots), ARIA attributes, and image load/error state without design props (size, shape, active, activeAppearance, color)
  • useAvatar_unstable delegates to useAvatarBase_unstable and adds design-specific props and the badge slot

Note: renderAvatar_unstable retains AvatarState as its parameter type because AvatarBaseState explicitly omits the badge slot — changing the render signature would require restructuring the component to handle badge externally.

Tracking: #35562

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 25, 2026

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-avatar
AvatarGroup
17.45 kB
6.995 kB
17.482 kB
7.002 kB
32 B
7 B
react-avatar
AvatarGroupItem
61.608 kB
19.326 kB
61.755 kB
19.357 kB
147 B
31 B
react-components
react-components: entire library
1.297 MB
324.042 kB
1.297 MB
324.204 kB
626 B
162 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-avatar
Avatar
48.367 kB
15.336 kB
react-components
react-components: Button, FluentProvider & webLightTheme
70.397 kB
19.96 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
236.663 kB
68.729 kB
react-components
react-components: FluentProvider & webLightTheme
43.612 kB
14.022 kB
react-persona
Persona
55.322 kB
17.279 kB
react-portal-compat
PortalCompatProvider
8.386 kB
2.624 kB
react-table
DataGrid
159.481 kB
44.953 kB
react-table
Table (Primitives only)
40.997 kB
13.172 kB
react-table
Table as DataGrid
130.702 kB
35.962 kB
react-table
Table (Selection only)
69.089 kB
19.325 kB
react-table
Table (Sort only)
67.732 kB
18.942 kB
react-tag-picker
@fluentui/react-tag-picker - package
186.596 kB
55.849 kB
react-tags
InteractionTag
13.666 kB
5.459 kB
react-tags
Tag
29.521 kB
9.389 kB
react-tags
TagGroup
82.211 kB
24.143 kB
react-timepicker-compat
TimePicker
108.174 kB
35.695 kB
react-tree
FlatTree
147.803 kB
42.147 kB
react-tree
PersonaFlatTree
149.631 kB
42.53 kB
react-tree
PersonaTree
145.691 kB
41.358 kB
react-tree
Tree
143.869 kB
40.986 kB
🤖 This report was generated against ca8968af85531cc12b0371680a0de44e884dfae0

@github-actions
Copy link
Copy Markdown

Pull request demo site: URL

@dmytrokirpa dmytrokirpa marked this pull request as ready for review March 26, 2026 16:47
@dmytrokirpa dmytrokirpa requested review from a team and ValentinaKozlova as code owners March 26, 2026 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants