Skip to content

Avatar

Identity fallback and presence indicators. CSS only

Avatar
Copy this markup
<span class="ui-avatar" data-ui-status="online" role="img" aria-label="Avery Stone, online">
<span data-ui-part="fallback">AS</span>
<span data-ui-part="status" aria-hidden="true"></span>
</span>

Install

Styles and registration
import '@timelessui/components/css/tokens.css'
import '@timelessui/components/css/avatar.css'

Anatomy

Parts are authored in your own markup and identified by the selector below, so your CSS can target the same anatomy without loading Timeless styles. Required parts must be present for the component to work. Private data-ui-internal-* hooks are written by the runtime and must never be authored.

PartRequiredSelectorPurpose
imageNo[data-ui-part~='image']The <img>. Give it an empty alt when a label follows.
fallbackNo[data-ui-part~='fallback']Initials or icon shown when no image loads.
statusNo[data-ui-part~='status']Presence dot. Decorative; keep it aria-hidden="true".

Attributes

Every value below is implemented by the stylesheets this component ships. Boolean attributes are presence-based: author the attribute with no value, or omit it.

AttributeValuesDefaultDescription
data-ui-sizesm · md · lgmdAvatar diameter.
data-ui-shapecircle · rounded · squarecircleCorner treatment.
data-ui-statusonline · away · busy · offlinePresence indicator color. Omit the attribute to hide the indicator. The dot is decorative, so also expose the status in text.

Styling

Root identity: ui-avatar. Required stylesheets: tokens.css, avatar.css.

This component adds no custom properties of its own. Restyle it through the design tokens or your own CSS.

Design tokens this component reads (11)

These are global Atmosphere tokens. Change them once at the theme level rather than per component.

--ui-bg-page · --ui-bg-surface-raised · --ui-danger · --ui-fg · --ui-fg-subtle · --ui-line · --ui-radius-lg · --ui-radius-pill · --ui-radius-sm · --ui-success · --ui-warning

Accessibility

Keep the native elements, roles, and relationships shown in the example. Timeless adds only the state and keyboard coordination the platform does not already provide, and it never supplies your accessible names — those depend on your content.

Before JavaScript runs

This primitive is CSS only. There is nothing to register and nothing to wait for.

More examples

Open Avatar in StoryLite for variants, controls, and manual testing.