Kinetic Avatar

A person or team picture that falls back to colored initials, with four sizes, two shapes and a presence dot.

  • <kt-kinetic-avatar>
  • Display
  • No framework

Kinetic Avatar

The code

Copy the Kinetic Avatar

Fastest: press Copy on the card above for one complete file. To build it into your own project, use the files below: the markup, the styles, this component’s script and the shared effects script (effects.js) that every component uses.

<kt-kinetic-avatar name="Mara Okafor" size="lg" status="online"></kt-kinetic-avatar>

<kt-kinetic-avatar name="Jonas Weber" size="lg" shape="square" status="away" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%23f59e0b'/%3E%3Cstop offset='1' stop-color='%23be123c'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='80' height='80' fill='url(%23g)'/%3E%3Ccircle cx='40' cy='32' r='14' fill='%23fff' fill-opacity='.88'/%3E%3Cpath d='M12 80c4-18 16-26 28-26s24 8 28 26z' fill='%23fff' fill-opacity='.88'/%3E%3C/svg%3E"></kt-kinetic-avatar>

<kt-kinetic-avatar name="Priya Raman" size="md" status="busy"></kt-kinetic-avatar>

<kt-kinetic-avatar name="Design Team" size="sm" shape="square"></kt-kinetic-avatar>

<span style="display:inline-flex;align-items:center;padding-left:2px"><kt-kinetic-avatar name="Ana Silva" size="md"></kt-kinetic-avatar><kt-kinetic-avatar name="Ben Carter" size="md" style="margin-left:-10px"></kt-kinetic-avatar><kt-kinetic-avatar name="Chloe Dubois" size="md" style="margin-left:-10px"></kt-kinetic-avatar><kt-kinetic-avatar name="Dev Patel" size="md" style="margin-left:-10px"></kt-kinetic-avatar></span>

Attributes

NameWhat it doesDefault
nameFull name. Gives the initials, the color and the accessible name.—
srcImage URL or data: URI. If it is missing or fails, the initials show.—
size"sm" (28px), "md" (40px), "lg" (56px) or "xl" (80px).md
shape"circle" or "square".circle
statusPresence dot: "online", "away", "busy" or "offline".—

Keyboard and screen readers

  • role="img" with an aria-label made of the name and the status, for example "Mara Okafor, online".
  • The image and initials inside are hidden from screen readers so the name is not read twice.
  • The initials color comes from the name, so the same person always gets the same color; white text on every palette color meets 4.5:1.
  • The avatar is not interactive. Wrap it in a button or link if it needs to be.

Styling variables

Every look is a CSS variable: --kt-accent, --kt-accent-ink, --kt-radius-btn, --kt-surface-radius, --kt-surface-bg, --kt-border-w, --kt-comp-shadow and --font-sans. The copied file sets them all from your choices.

FAQ

Kinetic Avatar: questions answered

How do I use the Kinetic Avatar?

Press Copy on the card to get a complete HTML file, or copy the HTML, CSS and JavaScript tabs into your own page. In your markup the element is written as <kt-kinetic-avatar>.

Which attributes does <kt-kinetic-avatar> accept?

name, src, size, shape, status. Each one is described in the attributes table on this page.

Is the Kinetic Avatar accessible?

role="img" with an aria-label made of the name and the status, for example "Mara Okafor, online". The image and initials inside are hidden from screen readers so the name is not read twice. The initials color comes from the name, so the same person always gets the same color; white text on every palette color meets 4.5:1. The avatar is not interactive. Wrap it in a button or link if it needs to be.

Can I change the Kinetic Avatar colors, corners and font?

Yes. Use the options on this page: accent color, border radius, background, border, shadow and Google font. The copied code already contains your choices, and every one of them is a CSS variable you can edit later.