Overview
A Persona holds an Avatar and up to three lines of text: the name, the role and a short description, such as an email address. After a divider, it can hold a row of actions or a Definition List of details.
Pick another component when:
Markup
Variants
The Actions and Details parts go at the end of .nds-persona, after the info block. Each part starts with its own divider.
| Group | Option | Markup | On element | Use |
|---|---|---|---|---|
| Size | LG (default) | — | — | An 80px avatar. For a profile page or a team page |
| Size | MD | .nds-md |
.nds-persona |
A 64px avatar and smaller text. For a side panel, a drawer or a list |
| Size | SM | .nds-sm |
.nds-persona |
A 48px avatar and the smallest text. For a menu or a narrow card. The site header’s user menu uses it |
| Layout | Row (default) | — | — | The avatar beside the text |
| Layout | Column (hint: Avatar above the text, aligned to the start) | .nds-vertical |
.nds-persona |
The avatar above the text, aligned to the start |
| Layout | Center (hint: Avatar above the text, everything centered) | .nds-center |
.nds-persona |
The avatar above the text, everything centered. For a profile header or a greeting |
| Avatar | No avatar | remove |
.nds-avatar |
Text only. For a menu where the user’s photo is already on the trigger |
| Extra | None (default) | — | — | Identity only |
| Extra | Actions | canon #persona-actions |
.nds-persona |
A row of links or buttons for this person’s account. Each button is as wide as its label |
| Extra | Details | canon #persona-details |
.nds-persona |
A definition list of facts about the person, such as a department or a location. For a directory entry |
Built-in Features
-
One Size Class for Every Part
A size class sets the size of the avatar and of all three lines together. You change one class, not four sizes.
-
Avatar Size From the Persona
The avatar inside takes its size from the Persona, so it needs no size class. A size class on the avatar still wins.
-
Full Row After the Divider
Every element after the
nds-dividertakes its own full row, below the avatar and the text: an action row, a definition list, or your own content. -
Knobs for Each Line
The name, the role and the description each have a font size, a line height and a color knob, such as
--persona-name-color. Restyle one line and keep the others.
Best Practices
- Give the avatar photo
alt="". The name is next to it, so a screen reader would read the name twice. - Keep the name, the role and the description to one line each. The description is one short identifier, such as an email address or a job code, not a sentence.
- Leave out any text line the person does not have. Do not write an empty
<span>. - Add actions only when they act on this person or this account. A directory entry that only shows a person needs no actions.
- Put the divider before the actions or the details. Without it, nothing separates them from the name above.
- For a byline with only a name, write the name as text. The full Persona adds weight that a byline does not need.
API
CSS Custom Properties
Set these knobs in the style attribute of .nds-persona. The MD and SM classes set the size knobs on the same element, so a rule in your stylesheet can lose to them.
| Property | Default | Controls |
|---|---|---|
--persona-name-FS |
var(--typo-text-xl-FS) |
Name font size |
--persona-name-LH |
var(--typo-text-xl-LH) |
Name line height |
--persona-name-color |
var(--text-display) |
Name color |
--persona-role-FS |
var(--typo-text-lg-FS) |
Role font size |
--persona-role-LH |
var(--typo-text-lg-LH) |
Role line height |
--persona-role-color |
var(--text-primary-paragraph) |
Role color |
--persona-description-FS |
var(--typo-text-md-FS) |
Description font size |
--persona-description-LH |
var(--typo-text-md-LH) |
Description line height |
--persona-description-color |
var(--text-secondary-paragraph) |
Description color |
--avatar-size |
80px (MD 64px, SM 48px) |
The avatar size. See Avatar |
MD takes every text one step down the type scale, and SM two steps.
Tokens
It reads these shared tokens. A change to one also changes other components: see Tokens.
Source: the var() reads in _sass/components/_persona.scss.
| Token | Preview | Value |
|---|---|---|
--text-displayRead by --persona-name-color | var(--colors-neutral-800)Dark mode var(--colors-neutral-100) | |
--text-primary-paragraphRead by --persona-role-color | var(--colors-neutral-700)Dark mode var(--colors-neutral-300) | |
--text-secondary-paragraphRead by --persona-description-color | var(--colors-neutral-500)Dark mode var(--colors-neutral-400) |