PresenceBadge
A person's availability as a small badge, usually placed on an Avatar (badge prop).
Every status has its own shape, so it is not conveyed by color alone: available (check), busy (solid), away (clock), offline (hollow ring with an X), do not disturb (bar), out of office (arrow, mirrored in right-to-left layouts). A background-colored ring separates it from the avatar. It is a named image (role="img", aria-label = the status name; pass aria-label to localise or extend it) and never a live region.
Examples
Available
export const Available: Story = {};Busy
export const Busy: Story = {
args: { status: 'busy' },
};Away
export const Away: Story = {
args: { status: 'away' },
};Offline
export const Offline: Story = {
args: { status: 'offline' },
};DND
export const DND: Story = {
args: { status: 'do-not-disturb' },
};OOF
export const OOF: Story = {
args: { status: 'out-of-office' },
};All Statuses
export const AllStatuses: Story = {
args: { size: 'extra-large' },
render: (args) => (
<div className="flex items-center gap-4">
{STATUSES.map((status) => (
<PresenceBadge key={status} {...args} status={status} />
))}
</div>
),
};Out Of Office
export const OutOfOffice: Story = {
args: { size: 'extra-large', outOfOffice: true },
render: (args) => (
<div className="flex items-center gap-4">
{STATUSES.map((status) => (
<PresenceBadge key={status} {...args} status={status} />
))}
</div>
),
};Props
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
status | 'available' | 'busy' | 'away' | 'offline' | 'do-not-disturb' | 'out-of-office' | 'blocked' | 'unknown' | No | 'available' | Presence status to display. The names of 0.x that 1.0 removed from the type, |
outOfOffice | boolean | No | false | Marks the person as out of office, whatever their status: the badge draws the out-of-office arrow in the status's own color on the page color, and its name gains ", out of office". With |
size | 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large' | No | 'medium' | Size of the presence indicator. In the |
ref | React.Ref<HTMLSpanElement> | No | Ref to the root | |
slotProps | { icon?: SlotPart<'svg'> } | No | Props for the element the badge draws inside its root, by part, merged into the part's own: your classes after the part's (yours win a conflict), your styles over its styles, your attributes and handlers added, your ref attached. Every attribute the badge sets on the part is locked. A part takes no |
Any other prop is passed to the element it renders (HTMLSpanElement).
Parts
icon
Stable class names
| Part | Class |
|---|---|
root | wave-presence-badge |
icon | wave-presence-badge__icon |