feat(react-badge): add useBadgeBase_unstable hook#35811
Merged
Conversation
…table, and usePresenceBadgeBase_unstable hooks Implements base state hooks for Badge, CounterBadge, and PresenceBadge components. Each base hook extracts pure component logic (slot structure, ARIA attributes, functional state) while omitting design props (appearance, color, shape, size). - BadgeBaseProps/BadgeBaseState: omits appearance, color, shape, size - CounterBadgeBaseProps/CounterBadgeBaseState: omits appearance, color, shape, size - PresenceBadgeBaseProps/PresenceBadgeBaseState: omits size (appearance/color/shape are not exposed) - useBadge_unstable now calls useBadgeBase_unstable internally - useCounterBadge_unstable now calls useCounterBadgeBase_unstable internally - All new types and hooks exported from package index.ts Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
af30d35 to
beb6fb4
Compare
|
Pull request demo site: URL |
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
📊 Bundle size reportUnchanged fixtures
|
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
e7e48b9 to
a998ad3
Compare
ValentinaKozlova
approved these changes
Mar 23, 2026
1 task
tudorpopams
pushed a commit
to tudorpopams/fluentui
that referenced
this pull request
Apr 14, 2026
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
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.


Summary
This PR adds base state hooks for the Badge, CounterBadge, and PresenceBadge components as part of the experimental base hooks initiative.
What was implemented
useBadgeBase_unstable— base hook forBadgecomponentBadgeBaseProps(omitsappearance,color,shape,size)BadgeBaseState(omitsappearance,color,shape,size)root,icon),iconPositiondefaultuseCounterBadgeBase_unstable— base hook forCounterBadgecomponentCounterBadgeBaseProps(omitsappearance,color,shape,size)CounterBadgeBaseState(omitsappearance,color,shape,size)count,dot,showZero,overflowCount), children text computationusePresenceBadgeBase_unstable— base hook forPresenceBadgecomponentPresenceBadgeBaseProps(omitssize)PresenceBadgeBaseState(omitsappearance,color,shape,size)aria-label,role="img"), status/outOfOffice state, icon selection (defaults to medium size)Refactoring
useBadge_unstablenow callsuseBadgeBase_unstableinternally and spreads the resultuseCounterBadge_unstablenow callsuseCounterBadgeBase_unstableinternallyExports
All new types and hooks are exported from the package
index.ts. They are NOT exported from@fluentui/react-components.🤖 Generated with Claude Code