docs/react-v9/contributing/rfcs/react-components/components/avatar-badge-shorthand.md
@behowell
How should the shorthand for Avatar's badge slot work?
The Avatar control's badge slot currently uses non-standard shorthand syntax, which is inconsistent with other controls.
For badge Unlike other slots, the content of the badge is the status prop of the PresenceBadge component, rather than the children prop.
E.g. with <Avatar badge="away" />, the badge slot renders <PresenceBadge status="away" size="smaller" />
Here's a summary of the 4 options that are detailed below:
<Avatar badge="away" /><Avatar badge={{ status: 'away' }} /><Avatar badge={<PresenceBadge status="away" size="smaller" />} /><Avatar status="away" />status of the PresenceBadge<Avatar badge="away" />
status instead of children)<Avatar badge={{ children: 'DF' }} />PresenceBadge, with no way to use a custom component
react-avatar includes PresenceBadge in the bundle even if it's not usedPresenceBadge with normal shorthand syntax<Avatar badge={{ status: 'away' }} />
<Avatar badge="DF" />PresenceBadge, with no way to use a custom componentreact-avatar includes PresenceBadge in the bundle even if it's not used<span> that can contain anything<Avatar badge={<PresenceBadge status="away" size="smaller" />} />
PresenceBadge:
<Avatar badge={<Badge>DF</Badge>} />
@fluentui/react-avatar package doesn't pull in PresenceBadgesize prop to the badge (it can't be automatically calculated from the Avatar's size).
medium doesn't line up with Avatar's default size (should use badge size smaller at the default Avatar size).<span> wrapper required around the badgestatus prop to AvatarIn this case, the badge slot would work the same as option 3, but adds a new status prop to Avatar:
<Avatar status="away" />
This would add a default child to the badge slot, with its status and size props set:
<PresenceBadge status="away" size="smaller" />
PresenceBadge, which is the common casebadge slotreact-avatar includes PresenceBadge in the bundle even if it's not usedAfter some discussion in #19527 Option 2 above, where the proposal is for the badge slot to be a PresenceBadge with normal shorthand syntax, has emerged as the preferred solution that we are going to be implementing going forward.