Persona
Display a person identity: avatar, presence badge and stacked text lines
Source
LLM docs
Docs
Package
Usage
Persona displays a person identity: an Avatar, an optional presence
badge and up to four text lines. Use it in people pickers, contact and chat lists,
comment authors and profile headers.
Avatar
avatar prop accepts Avatar props or a custom React node. When avatar is
not set, an avatar with initials generated from the name prop is displayed. To render
Persona without an avatar, use the presenceOnly prop or
compound components without Persona.Avatar.
By default, the avatar color is generated from the name prop. Set color in the avatar
prop to override it:
Presence
Set presence prop to display a status badge on the avatar. It accepts a status string or a
configuration object:
The configuration object supports two modifiers: outOfOffice renders the badge as a ring
for any status, processing adds a pulsing animation.
Presence only
Set presenceOnly prop to display the presence badge inline with the text, without an
avatar:
Text lines
Persona renders up to four text lines. Long lines are truncated with an ellipsis,
the full text of string lines is available on hover:
Size
size prop scales the avatar, the presence badge, the text and the gap between
the avatar and the text. Change size in the configurator above to see how it scales.
Text position and alignment
Use textPosition prop to place the text after (default), before or below the avatar.
textAlignment prop (start or center) controls how the text block is aligned.
Change these props in the configurator above to see how they work.
Radius
Set radius prop to change the avatar border-radius. The presence badge position is
adjusted to the avatar shape: it sits on the circle edge of round avatars and on the corner
of square ones. With compound components, set radius on Persona, not on Persona.Avatar.
Polymorphic component
Persona is a polymorphic component, its default root element is
div. Set component prop to render it as a link or a button. Browser default styles of
a and button elements are reset. A button root shrinks to its content – set w="100%"
to stretch it to the container width:
Compound components
For full control over the layout, use compound components instead of the shorthand props:
Persona.Avatar– avatar, accepts Avatar props. Initials are generated from thenameprop ofPersonaor from its ownnameprop.Persona.Presence– presence badge, acceptspresenceandlabelspropsPersona.Text– text line,levelprop (1–4) controls its importance:1is the primary line (person name),2–4are secondary lines
Persona.Avatar and Persona.Presence can be wrapped in a component that does not render
its own element, for example Tooltip.
Example: people list
Accessibility
- The status is rendered as visually hidden text. Screen readers announce the name first and the status last, for example "Jane Doe, Product designer, Available".
- Statuses are announced in English by default. Use
labelsprop to translate them,outOfOfficeis the suffix added when theoutOfOfficemodifier is set:
- When a text line already displays the status (for example
tertiaryText="Available"), set that status label to an empty string (labels={{ available: '' }}), so the status is not announced twice. - The avatar is hidden from assistive technologies by default, because the name
is rendered next to it. Set
altin theavatarprop or onPersona.Avatarwhen the avatar is displayed without text. - A custom node passed to the
avatarprop is not hidden. Addaria-hiddento it if it is decorative.
Styles API
Persona supports the Styles API; you can add styles to any inner element of the component with the classNames prop. Follow the Styles API documentation to learn more.
Component Styles API
Hover over selectors to highlight corresponding elements