Skip to content

Persona

Persona

A person's avatar next to their name and up to three more text lines (job title, location, status), with an optional presence badge. The text can sit after, before or below the avatar (textPosition), presenceOnly swaps the avatar for the presence badge, and the text scales with size up to huge.

The built-in avatar is decorative (<Avatar decorative>): the visible name is announced once, not a second time as the avatar's image name. The presence badge stays exposed as a named image.

Examples

Default

Jane Doe
export const Default: Story = {};

With Badge

Jane Doe
export const WithBadge: Story = {
  args: {
    status: 'available',
  },
};

With Secondary Text

Jane DoeSoftware Engineer
export const WithSecondaryText: Story = {
  args: {
    secondaryText: 'Software Engineer',
    status: 'busy',
  },
};

With Image

Jane DoeProduct Designer
export const WithImage: Story = {
  args: {
    src: 'data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20viewBox=%270%200%2064%2064%27%3E%3Crect%20width=%2764%27%20height=%2764%27%20fill=%27%23c8c6c4%27/%3E%3Ccircle%20cx=%2732%27%20cy=%2725%27%20r=%2711%27%20fill=%27%23605e5c%27/%3E%3Cpath%20d=%27M12%2064a20%2020%200%200%201%2040%200z%27%20fill=%27%23605e5c%27/%3E%3C/svg%3E',
    secondaryText: 'Product Designer',
    status: 'away',
  },
};

Text Positions

Jane DoeSoftware engineer
Jane DoeSoftware engineer
Jane DoeSoftware engineer
export const TextPositions: Story = {
  args: { secondaryText: 'Software engineer' },
  render: (args) => (
    <div className="flex flex-wrap items-center gap-8">
      <Persona {...args} textPosition="after" />
      <Persona {...args} textPosition="before" />
      <Persona {...args} textPosition="below" />
    </div>
  ),
};

Four Lines And Huge

Jane DoeSoftware engineerContoso, OsloAvailable for review
export const FourLinesAndHuge: Story = {
  args: {
    size: 'huge',
    secondaryText: 'Software engineer',
    tertiaryText: 'Contoso, Oslo',
    quaternaryText: 'Available for review',
    status: 'available',
  },
};

Presence Only

Jane DoeDo not disturb
export const PresenceOnly: Story = {
  args: { presenceOnly: true, status: 'do-not-disturb', secondaryText: 'Do not disturb' },
};

Props

NameTypeRequiredDefaultDescription
namestringNo

Display name of the person. It gives the avatar its initials and the first text line its text (unless primaryText is given). A persona with neither name nor primaryText warns in development.

primaryTextSlot<'span'>Nothe `name`

The first text line (the name). A string, an element or an object of <span> attributes.

secondaryTextSlot<'span'>No

The second text line, such as a job title or email.

tertiaryTextSlot<'span'>No

The third text line, such as a location.

quaternaryTextSlot<'span'>No

The fourth text line, such as a status message.

textPosition'after' | 'before' | 'below'No'after'

Where the text sits relative to the avatar, in reading order: after it, before it, or below it.

textAlignment'start' | 'center'No'start' ('center' when the text is below the avatar)

How the text lines align with each other.

presenceOnlybooleanNofalse

Shows only the presence badge (from status or badge) in place of the avatar. The text stays.

srcstringNo

URL of the person's avatar image.

size'extra-small' | 'small' | 'medium' | 'large' | 'extra-large' | 'huge'No'medium'

Size of the persona: its avatar and its text.

status'available' | 'busy' | 'away' | 'offline' | 'do-not-disturb' | 'out-of-office' | 'blocked' | 'unknown'No

Presence status shown as a badge on the avatar. Ignored when a badge is given.

avatarSlot<'span'>No

Slot for a custom avatar element, replacing the built-in one. The name is already visible next to it, so make a custom avatar decorative (e.g. <Avatar decorative … />). A value that renders nothing (null, false, '', 0, NaN, or an array, Set or generator of only such items) counts as not given.

badgeSlot<'span'>No

Slot for a custom badge element. Takes precedence over status. A value that renders nothing (null, false, '', 0, NaN, e.g. badge={count && <CounterBadge count={count} />}, or an array, Set or generator of only such items) counts as not given.

refReact.Ref<HTMLDivElement>No

Ref to the root <div>.

Any other prop is passed to the element it renders (HTMLDivElement).

Stable class names

PartClass
rootwave-persona
avatarwave-persona__avatar
badgewave-persona__badge
primaryTextwave-persona__primary-text
secondaryTextwave-persona__secondary-text
tertiaryTextwave-persona__tertiary-text
quaternaryTextwave-persona__quaternary-text