Persona

Display a person identity: avatar, presence badge and stacked text lines

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.

Vitaly Rtishchev
Creator of Mantine
Local time 4:32 PM
Available
Size
Text position
Text alignment
import { Persona } from '@mantine/core';
function Demo() {
  return (
    <Persona
      name="Vitaly Rtishchev"
      secondaryText="Creator of Mantine"
      tertiaryText="Local time 4:32 PM"
      avatar={{ src: image }}
      presence="available"
    />
  );
}

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.

Jane Doe
Product designer
Busy, out of office
import { Persona } from '@mantine/core';

function Demo() {
  return (
    <Persona
      name="Jane Doe"
      secondaryText="Product designer"
      presence={{ status: 'busy', outOfOffice: true }}
    />
  );
}

By default, the avatar color is generated from the name prop. Set color in the avatar prop to override it:

import { Avatar, Persona } from '@mantine/core';

function Demo() {
  return (
    <>
      {/* Avatar with an image */}
      <Persona name="Jane Doe" avatar={{ src: 'https://example.com/avatar.png' }} />

      {/* Avatar with initials and a custom color */}
      <Persona name="Jane Doe" avatar={{ color: 'blue' }} />

      {/* Custom avatar node, aria-hidden because the name is rendered next to it */}
      <Persona
        name="Jane Doe"
        avatar={
          <Avatar color="grape" aria-hidden>
            JD
          </Avatar>
        }
      />
    </>
  );
}

Presence

Set presence prop to display a status badge on the avatar. It accepts a status string or a configuration object:

Jane Doe
available
Jane Doe
away
Jane Doe
busy
Jane Doe
do-not-disturb
Jane Doe
offline
Jane Doe
out-of-office
Jane Doe
blocked
Jane Doe
unknown
import { Persona, SimpleGrid } from '@mantine/core';

const statuses = [
  'available',
  'away',
  'busy',
  'do-not-disturb',
  'offline',
  'out-of-office',
  'blocked',
  'unknown',
] as const;

function Demo() {
  return (
    <SimpleGrid cols={{ base: 1, xs: 2 }}>
      {statuses.map((status) => (
        <Persona
          key={status}
          name="Jane Doe"
          secondaryText={status}
          presence={status}
          labels={{ [status]: '' }}
        />
      ))}
    </SimpleGrid>
  );
}

The configuration object supports two modifiers: outOfOffice renders the badge as a ring for any status, processing adds a pulsing animation.

import { Persona } from '@mantine/core';

function Demo() {
  return (
    <>
      <Persona name="Jane Doe" presence="available" />
      <Persona name="Jane Doe" presence={{ status: 'available', outOfOffice: true }} />
      <Persona name="Jane Doe" presence={{ status: 'available', processing: true }} />
    </>
  );
}

Presence only

Set presenceOnly prop to display the presence badge inline with the text, without an avatar:

API
All systems operational
Available
Database
Degraded performance
Away
CDN
Major outage
Busy
import { Persona, Stack } from '@mantine/core';

function Demo() {
  return (
    <Stack gap="xs">
      <Persona name="API" secondaryText="All systems operational" presence="available" presenceOnly />
      <Persona name="Database" secondaryText="Degraded performance" presence="away" presenceOnly />
      <Persona name="CDN" secondaryText="Major outage" presence="busy" presenceOnly />
    </Stack>
  );
}

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:

import { Persona } from '@mantine/core';

function Demo() {
  return (
    <Persona
      name="Vitaly Rtishchev"
      secondaryText="Creator of Mantine"
      tertiaryText="Remote, Berlin"
      quaternaryText="Local time 4:32 PM"
    />
  );
}

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.

Vitaly Rtishchev
radius: 1000px (default)
Available
Vitaly Rtishchev
radius: xl
Available
Vitaly Rtishchev
radius: md
Available
Vitaly Rtishchev
radius: 0
Available
import { Persona, Stack } from '@mantine/core';

function Demo() {
  return (
    <Stack>
      <Persona
        name="Vitaly Rtishchev"
        secondaryText="radius: 1000px (default)"
        avatar={{ src: image }}
        presence="available"
      />
      <Persona
        name="Vitaly Rtishchev"
        secondaryText="radius: xl"
        avatar={{ src: image }}
        presence="available"
        radius="xl"
      />
      <Persona
        name="Vitaly Rtishchev"
        secondaryText="radius: md"
        avatar={{ src: image }}
        presence="available"
        radius="md"
      />
      <Persona
        name="Vitaly Rtishchev"
        secondaryText="radius: 0"
        avatar={{ src: image }}
        presence="available"
        radius={0}
      />
    </Stack>
  );
}

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:

import { Persona } from '@mantine/core';

function Demo() {
  return (
    <Persona
      component="a"
      href="https://mantine.dev"
      name="Vitaly Rtishchev"
      secondaryText="Open profile"
      presence="available"
    />
  );
}

Compound components

For full control over the layout, use compound components instead of the shorthand props:

Vitaly Rtishchev
Creator of Mantine
Available
import { Persona } from '@mantine/core';

function Demo() {
  return (
    <Persona>
      <Persona.Avatar src={image} />
      <Persona.Presence presence="available" />
      <Persona.Text level={1}>Vitaly Rtishchev</Persona.Text>
      <Persona.Text level={2}>Creator of Mantine</Persona.Text>
    </Persona>
  );
}
  • Persona.Avatar – avatar, accepts Avatar props. Initials are generated from the name prop of Persona or from its own name prop.
  • Persona.Presence – presence badge, accepts presence and labels props
  • Persona.Text – text line, level prop (1–4) controls its importance: 1 is the primary line (person name), 2–4 are 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

Emily Johnson
Product manager
Available
Kevin Gilbert
Frontend developer
Do not disturb
Mary Smith
UX researcher
Busy, out of office
Robert Wolf
Backend developer
Offline
import { Paper, Persona, PersonaPresenceValue, Stack } from '@mantine/core';

const members: { name: string; role: string; image: string; presence: PersonaPresenceValue }[] = [
  { name: 'Emily Johnson', role: 'Product manager', image: image1, presence: 'available' },
  { name: 'Kevin Gilbert', role: 'Frontend developer', image: image2, presence: 'do-not-disturb' },
  { name: 'Mary Smith', role: 'UX researcher', image: image3, presence: { status: 'busy', outOfOffice: true } },
  { name: 'Robert Wolf', role: 'Backend developer', image: image4, presence: 'offline' },
];

function Demo() {
  return (
    <Paper withBorder p="md" radius="md">
      <Stack gap="lg">
        {members.map((person) => (
          <Persona
            key={person.name}
            name={person.name}
            secondaryText={person.role}
            avatar={{ src: person.image }}
            presence={person.presence}
          />
        ))}
      </Stack>
    </Paper>
  );
}

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 labels prop to translate them, outOfOffice is the suffix added when the outOfOffice modifier is set:
import { Persona } from '@mantine/core';

function Demo() {
  return (
    <Persona
      name="Jane Doe"
      presence={{ status: 'busy', outOfOffice: true }}
      labels={{
        available: 'Verfügbar',
        away: 'Abwesend',
        busy: 'Beschäftigt',
        outOfOffice: 'nicht im Büro',
      }}
    />
  );
}
  • 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 alt in the avatar prop or on Persona.Avatar when the avatar is displayed without text.
  • A custom node passed to the avatar prop is not hidden. Add aria-hidden to 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.

Vitaly Rtishchev
Creator of Mantine
Local time 4:32 PM
Available

Component Styles API

Hover over selectors to highlight corresponding elements

/*
 * Hover over selectors to apply outline styles
 *
 */