Persona
Display a person identity: avatar, presence badge and stacked text lines
Source
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 lists, comment authors and profile headers:
Avatar
avatar prop accepts Avatar props or a custom React node. When it is not set,
initials generated from the name prop are displayed. To render Persona without an avatar,
use the presenceOnly prop:
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
an object with outOfOffice and processing modifiers:
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:
Radius
Set radius prop to change the avatar border-radius, the presence badge follows the avatar
shape. With compound components, set radius on Persona, not on Persona.Avatar:
Polymorphic component
Persona is a polymorphic component, set component prop to render it
as a link or a button. A button root shrinks to its content, set w="100%" to stretch it:
Compound components
For full control over the layout, use Persona.Avatar, Persona.Presence and Persona.Text
compound components instead of the shorthand props. level prop of Persona.Text sets the
line importance, 1 is the person name:
Example: people list
Accessibility
- The status is announced after the name and text lines, for example "Jane Doe, Product designer, Available"
- Statuses are announced in English by default. Use
labelsprop to translate them:
- When a text line already displays the status, set that status label to an empty string,
for example
labels={{ available: '' }}, so it is not announced twice - The avatar is hidden from assistive technologies, because the name is rendered next to it.
Set
altin theavatarprop when 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 or focus a selector to highlight its elements