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
export const Default: Story = {};With Badge
export const WithBadge: Story = {
args: {
status: 'available',
},
};With Secondary Text
export const WithSecondaryText: Story = {
args: {
secondaryText: 'Software Engineer',
status: 'busy',
},
};With Image
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
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
export const FourLinesAndHuge: Story = {
args: {
size: 'huge',
secondaryText: 'Software engineer',
tertiaryText: 'Contoso, Oslo',
quaternaryText: 'Available for review',
status: 'available',
},
};Presence Only
export const PresenceOnly: Story = {
args: { presenceOnly: true, status: 'do-not-disturb', secondaryText: 'Do not disturb' },
};Props
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | No | Display name of the person. It gives the avatar its initials and the first text line its text (unless | |
primaryText | Slot<'span'> | No | the `name` | The first text line (the name). A string, an element or an object of |
secondaryText | Slot<'span'> | No | The second text line, such as a job title or email. | |
tertiaryText | Slot<'span'> | No | The third text line, such as a location. | |
quaternaryText | Slot<'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. |
presenceOnly | boolean | No | false | Shows only the presence badge (from |
src | string | No | 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 | |
avatar | Slot<'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. | |
badge | Slot<'span'> | No | Slot for a custom badge element. Takes precedence over | |
ref | React.Ref<HTMLDivElement> | No | Ref to the root |
Any other prop is passed to the element it renders (HTMLDivElement).
Stable class names
| Part | Class |
|---|---|
root | wave-persona |
avatar | wave-persona__avatar |
badge | wave-persona__badge |
primaryText | wave-persona__primary-text |
secondaryText | wave-persona__secondary-text |
tertiaryText | wave-persona__tertiary-text |
quaternaryText | wave-persona__quaternary-text |