Skip to content
ShineUI
Install

Avatar

People at a glance.

<sui-avatar><sui-persona>MiscStable

About

Initials or image for a person: the topbar, a table row, an activity feed. The brand marks everyone else and the accent, with accent, marks the signed-in user only; a failed image falls back to initials. For a name and a second line beside the avatar, use sui-persona.

Usage

<sui-avatar name="Dana Whitfield" size="md"></sui-avatar> <script type="module"> import { defineCustomElements } from "@shineui/core/loader"; import "@shineui/core/shineui.css"; defineCustomElements(); </script>
import { SuiAvatar } from "@shineui/react"; import "@shineui/core/shineui.css"; export function Example() { return <SuiAvatar name="Dana Whitfield" size="md" />; }
<script setup> import { SuiAvatar } from "@shineui/vue"; import "@shineui/core/shineui.css"; </script> <template> <SuiAvatar name="Dana Whitfield" size="md" /> </template>
import { Component } from "@angular/core"; import { SuiAvatar } from "@shineui/angular"; @Component({ standalone: true, imports: [SuiAvatar], template: `<sui-avatar name="Dana Whitfield" size="md"></sui-avatar>`, }) export class Example { }

Basic

The avatar renders as role="img" named from name, so a screen reader reads the person, not the two letters. Initials are the first letter of the first two words of name; set initials yourself when that is not the pair you want.

<sui-avatar name="Dana Whitfield" size="md"></sui-avatar>

Sizes

xs 22, sm 26, md 32, lg 40 and xl 56 px. Initials scale at 36% of the box, so every size stays legible.

<div style="display:flex;flex-wrap:wrap;gap:12px;align-items:center"> <sui-avatar name="Priya Raman" size="xs"></sui-avatar> <sui-avatar name="Priya Raman" size="sm"></sui-avatar> <sui-avatar name="Priya Raman"></sui-avatar> <sui-avatar name="Priya Raman" size="lg"></sui-avatar> <sui-avatar name="Priya Raman" size="xl"></sui-avatar> </div>

Tones and shape

Navy is everyone else; orange marks the signed-in user only. square swaps the circle for 8px corners, which suits an organization rather than a person.

<div style="display:flex;flex-wrap:wrap;gap:12px;align-items:center"> <sui-avatar name="Marcus Lee"></sui-avatar> <sui-avatar name="Dana Whitfield" accent></sui-avatar> <sui-avatar name="Falls City Supply Co." initials="FC" square></sui-avatar> <sui-avatar initials="AP" square size="lg"></sui-avatar> </div>

Badge

badge puts a glyph on a disc at the corner: the kind of event on an inbox row, the way Linear marks a comment or a mention on the actor. badge-tone paints it from the status ladder or the brand and accent roles; neutral is the default. The disc is aria-hidden, so the row text has to say what happened.

<div style="display:flex;flex-wrap:wrap;gap:12px;align-items:center"> <sui-avatar name="Priya Raman" badge="fa-solid fa-comment"></sui-avatar> <sui-avatar name="Dana Whitfield" badge="fa-solid fa-at" badge-tone="brand"></sui-avatar> <sui-avatar name="Tom Gordon" badge="fa-solid fa-check" badge-tone="positive"></sui-avatar> <sui-avatar name="Marcus Lee" badge="fa-solid fa-triangle-exclamation" badge-tone="attention"></sui-avatar> <sui-avatar name="Greg Cockerel" badge="fa-solid fa-circle-exclamation" badge-tone="critical"></sui-avatar> <sui-avatar name="Priya Raman" size="sm" badge="fa-solid fa-comment" badge-tone="info"></sui-avatar> <sui-avatar src="/docs/assets/imagery/manufacturing-160.webp" name="Kestrel Logistics" size="lg" square badge="fa-solid fa-star" badge-tone="accent"></sui-avatar> </div>

Image and fallback

An image fills the box and its alt is empty, because the host already carries the name. A src that fails to load falls back to the initials instead of leaving a hole.

The second src is broken on purpose.
<div style="display:flex;flex-wrap:wrap;gap:12px;align-items:center"> <sui-avatar src="/docs/assets/imagery/manufacturing-160.webp" name="Kestrel Logistics" size="lg" square></sui-avatar> <sui-avatar src="/docs/assets/imagery/does-not-exist.jpg" name="Greg Cockerel" size="lg"></sui-avatar> <span style="font:460 12px/1.6 var(--font-sans);color:var(--ink-faint)">The second src is broken on purpose.</span> </div>

Persona

sui-persona is the avatar with a name and a second line beside it: the user row in a table, an activity feed or a topbar menu. meta is a faint right-aligned note, and inverse swaps to white ink for navy chrome such as the side nav footer.

<div style="display:grid;gap:12px;max-width:420px"> <sui-persona name="Dana Whitfield" secondary="dana@fallscitysupply.com" meta="Signed in" accent></sui-persona> <sui-persona name="Marcus Lee" secondary="Staff accountant" meta="Yesterday" size="sm"></sui-persona> <sui-persona name="Falls City Supply Co." initials="FC" secondary="Vendor since 2019"></sui-persona> <div style="background:var(--brand);padding:10px 12px;border-radius:10px"> <sui-persona name="Priya Raman" secondary="priya@fallscitysupply.com" inverse></sui-persona> </div> </div>

The user-row patternsui-persona

Avatar, name and secondary line with an optional meta note at the end of the row.

<div style="display:flex;flex-direction:column;gap:12px;max-width:420px"> <sui-persona name="Dana Whitfield" secondary="dana.whitfield@fallscitysupply.com" accent meta="Admin" style="display:flex"></sui-persona> <sui-persona name="Greg Cockerel, CPA" secondary="Ashbrook and Reed · External accountant" meta="Yesterday" style="display:flex"></sui-persona> </div>

Name weightsui-persona

weight sets the name from the type ramp: regular, medium, semibold, bold or heavy. Unset, the name is 640, a step under bold. In a list whose title is medium, weight="medium" keeps the assignee from outweighing the row; the second line and the meta note do not move.

Raise the gateway quota
Rotate the signing keys
Retire the legacy exporter
<div style="max-width:520px"> <div style="display:flex;align-items:center;justify-content:space-between;gap:16px;padding:10px 0;border-bottom:1px solid var(--hairline)"><span style="font-size:var(--text-md);font-weight:var(--w-medium);color:var(--ink)">Raise the gateway quota</span><sui-persona name="Dana Whitfield" size="xs" weight="medium"></sui-persona></div> <div style="display:flex;align-items:center;justify-content:space-between;gap:16px;padding:10px 0;border-bottom:1px solid var(--hairline)"><span style="font-size:var(--text-md);font-weight:var(--w-medium);color:var(--ink)">Rotate the signing keys</span><sui-persona name="Tom Gordon" size="xs" weight="medium"></sui-persona></div> <div style="display:flex;align-items:center;justify-content:space-between;gap:16px;padding:10px 0;border-bottom:1px solid var(--hairline);border-bottom:0"><span style="font-size:var(--text-md);font-weight:var(--w-medium);color:var(--ink)">Retire the legacy exporter</span><sui-persona name="Priya Natarajan" size="xs"></sui-persona></div> </div>

Inverse on navy chromesui-persona

The SideNav footer state.

<div style="background:var(--brand);padding:14px 16px;border-radius:var(--radius-lg);max-width:228px"> <sui-persona name="Dana Whitfield" secondary="Administrator" accent inverse></sui-persona> </div>

API

<sui-avatar>

Properties

PropertyAttributeTypeDefaultDescription
accentaccentbooleanfalseThe accent fill: the signed-in user.
badgebadgestringstring | undefinedFont Awesome class for a small glyph on a disc at the bottom-right corner: the kind of event on an inbox row's avatar, a comment or an assignment. The disc is 8px on xs, 10px on sm, 12px on md and 14px above, seated on the rim clear of the initials and ringed in the surface so it reads against the fill. It is aria-hidden: the row's own text carries the meaning.
badgeTonebadge-toneSuiAvatarBadgeTone"accent" | "attention" | "brand" | "critical" | "info" | "neutral" | "positive"'neutral'Color role of the badge disc: brand, accent, or the status ladder positive, info, attention, critical and neutral (the default), painted from the same tokens as sui-badge. An unknown value paints neutral.
initialsinitialsstringstring | undefinedExplicit initials. Overrides the ones derived from name.
namenamestringstring | undefinedFull name. Drives the two-letter initials (the first letter of the first two words) and the accessible name, read through role="img".
sizesizeSuiAvatarSize"lg" | "md" | "sm" | "xl" | "xs"'md'Box size: xs 22px, sm 26px, md 32px, lg 40px, xl 56px. Initials scale at 36% of the box.
squaresquarebooleanfalse8px corners instead of a circle.
srcsrcstringstring | undefinedImage URL. Fills the box with an empty alt, since the host carries the name; falls back to initials when the image fails to load.

Types

SuiAvatarBadgeTone typeColor role of the corner badge: the two emphasis roles plus the shared status ladder.
No members.
SuiAvatarSize type
No members.

<sui-persona>

Properties

PropertyAttributeTypeDefaultDescription
accentaccentbooleanfalseOrange avatar: the signed-in user.
initialsinitialsstringstring | undefinedExplicit avatar initials.
inverseinversebooleanfalseInks fitted for the brand fill (SideNav footer): --brand-contrast for the name and the contrast-mode muted rung for the second line, so dark mode clears 4.5:1.
metametastringstring | undefinedFaint note at the end of the row (role, relative time).
namenamestring''Display name, also the avatar's initials source.
secondarysecondarystringstring | undefinedSecond line: email, role, firm.
sizesizeSuiPersonaSize"lg" | "md" | "sm" | "xs"'md'Avatar size: xs 22px, sm 26px, md 32px, lg 40px.
srcsrcstringstring | undefinedAvatar image URL.
weightweightSuiPersonaWeight"bold" | "heavy" | "medium" | "regular" | "semibold" | undefinedWeight of the name, one of the ramp's stops: regular 460, medium 550, semibold 620, bold 650, heavy 700. Unset, the name keeps its shipped 640, a step under bold. In a table whose title column is medium, set medium so an assignee does not outweigh the row's own title. The second line and the meta note keep their weights.

Types

SuiPersonaSize type
No members.
SuiPersonaWeight typeWeight of the name, from the type ramp.
No members.

Theming

Every design token this element can render with, read from its own stylesheets and the ones it imports. Set a token on :root or on any ancestor and every use below follows it. The values shown are the ones in the theme you are viewing. The list is read per stylesheet, so an element that imports a shared drawing module lists that module's tokens too, whether or not it paints with all of them.

See also