Avatar

Data Display
stable

Circular or rounded media container for user images, icons or initials text.

Preview

Rendering the live preview…

image

Rendering the live preview…

icon

Rendering the live preview…

text

Rendering the live preview…

large

Rendering the live preview…

rounded

Structure

Anatomy

Visual breakdown of the component's internal structure with BEM class call-outs.

Anatomy of OrigamAvatarSchematic of the Avatar component with 4 numbered internal parts. image/icon/text 1 2 3 origam-avatar __wrapper __image / __icon / __text Priority: image → icon → text (mutually exclusive slots)
Anatomy of <origam-avatar> — 4 internal parts. Content priority: image wins over icon wins over text.
1.origam-avatar
Root element. Circle by default via border-radius: {radius.full}. Size tokens set height and width.
2.origam-avatar__wrapper
Inner flex container (inline-flex; align-items: center; justify-content: center). Fills 100% of the root.
3.origam-avatar__image
Image container. Present only when hasImage. Wraps OrigamImg with overflow: hidden; border-radius: inherit. Creates a stacking context for the negative z-index on the inner img.
4.origam-avatar__icon / .origam-avatar__text
Fallback content zones. __icon wraps OrigamIcon; __text wraps a <span> with initials. Mutually exclusive with the image zone.

API

Props

All props accepted by this component, with their type, default value and description.

icon
MDI or custom icon rendered centered inside the avatar. Shown when no image is provided.
image
string | ISrcObject
Image URL or ISrcObject (srcset / lazy-src). Takes precedence over icon and text.
text
string
Initials or short label rendered inside the avatar when no image or icon is set.
id
string
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
density
'default'
Adjusts the effective avatar size via the density offset.
Border-radius token. Default is full circle ({radius.full}).
roundedTopRight
boolean | number | string
roundedTopLeft
boolean | number | string
roundedBottomLeft
boolean | number | string
roundedBottomRight
boolean | number | string
roundedStartStart
boolean | number | string
roundedStartEnd
boolean | number | string
roundedEndStart
boolean | number | string
roundedEndEnd
boolean | number | string
size
'default'
Controls the avatar diameter via design tokens (24 / 32 / 40 / 48 / 56px).
tag
string
'div'
HTML element rendered at the root.
color
Foreground/text color applied to the avatar surface.
bgColor
Background color of the avatar when no image is shown.
padding
boolean | number | string
paddingTop
boolean | number | string
paddingLeft
boolean | number | string
paddingBottom
boolean | number | string
paddingRight
boolean | number | string
paddingBlock
boolean | number | string
paddingInline
boolean | number | string
paddingInlineStart
boolean | number | string
paddingInlineEnd
boolean | number | string
paddingBlockStart
boolean | number | string
paddingBlockEnd
boolean | number | string
margin
boolean | number | string
marginTop
boolean | number | string
marginLeft
boolean | number | string
marginBottom
boolean | number | string
marginRight
boolean | number | string
marginBlock
boolean | number | string
marginInline
boolean | number | string
marginInlineStart
boolean | number | string
marginInlineEnd
boolean | number | string
marginBlockStart
boolean | number | string
marginBlockEnd
boolean | number | string
border
boolean | number | string | TDirectionBoth | Array<TDirectionBoth>
false
Applies a border ring around the avatar.
borderTop
boolean | number | string
borderLeft
boolean | number | string
borderBottom
boolean | number | string
borderRight
boolean | number | string
borderBlock
boolean | number | string
borderInline
boolean | number | string
borderInlineStart
boolean | number | string
borderInlineEnd
boolean | number | string
borderBlockStart
boolean | number | string
borderBlockEnd
boolean | number | string
borderColor
string
borderStyle
string
borderTopColor
TColor
borderRightColor
TColor
borderBottomColor
TColor
borderLeftColor
TColor
borderInlineStartColor
TColor
borderInlineEndColor
TColor
borderBlockStartColor
TColor
borderBlockEndColor
TColor
elevation
TElevation
Box-shadow elevation token.
hover
boolean | IStateEffectConfig
false
Enables hover state tracking and propagation.
hoverClass
string
active
boolean | IStateEffectConfig
false
Forces the avatar into its active/selected visual state.
activeClass
string
fontSize
TFontSize
fontWeight
TFontWeight
lineHeight
TLineHeight
letterSpacing
TLetterSpacing

API

Slots

Content slots exposed by this component.

#default
Custom content rendered inside the avatar, replacing image/icon/text auto-rendering.
#avatar
Replaces the OrigamImg element inside the image zone.
#icon
Replaces the OrigamIcon element inside the icon zone.
#text
Replaces the text span inside the text zone.

API

Emits

Events emitted by this component.

@update:active
any
Propagates the active/selected state.
@update:hover
boolean
Propagates the hover state when hover tracking is enabled.

API

Exposed members

Properties and methods accessible via template ref (defineExpose). Use them for programmatic control.

<T extends object>(props: T, exclude?: string[]) => Partial<T>
Utility to forward a filtered subset of props to a child component.
Ref<string>
Reactive CSS string generated by useStyle from the computed avatarStyles.
string
Unique style-sheet ID for this instance.
() => void
Injects the computed style sheet. Called automatically on mount.
() => void
Removes the injected style sheet. Called automatically on unmount.
Ref<boolean>
True once the style sheet has been injected into the DOM.

Customisation

CSS variables

CSS custom properties exposed by this component. Override them to customise the component without losing theme compatibility.

Avatar background when no image is shown. Overridden by bgColor prop and status.
Foreground (icon/text) color. Overridden by color prop and status.
Border radius. Full circle by default; overridden by the rounded prop.
Avatar height. Set per size variant (24 / 32 / 40 / 48 / 56px).
Avatar width. Set per size variant (same as height).
Density offset subtracted from height and width. compact=+8px, comfortable=-8px.
Icon/text font size. Set per size variant.
Avatar box shadow. Changed to {shadow.md} when elevation is set.

Inclusion

Accessibility

ARIA roles, keyboard navigation and focus management. Sourced from the real component template.

Notes

  • When using the image prop, pass an ISrcObject with an alt property to provide a text alternative for screen readers. Plain string URLs result in an empty alt.
  • Icon-only avatars should be wrapped in a container with an accessible label (e.g. aria-label on the parent) when they convey meaning.
  • When active=true or the avatar is used in an interactive context (click handlers), wrap it in a button or add role="button" with a keyboard handler.

Foundation

Design tokens

Excerpt from this component's token declarations — the --origam-<component>---<property> variables, declared in its hand-maintained token sheet with no build step.

Source
color
var(--origam-color__surface---overlay)
Default avatar background (when no image).
dimension
var(--origam-radius---full)
Full-circle border radius by default.
dimension
40px
Default size (40×40px).
dimension
24px
X-small size (24×24px).
dimension
72px
X-large size (72×72px).
duration
var(--origam-motion__duration---medium)
Transition duration for size, dimension and color changes.

Interactive

Playground

Edit props live and see the component update in real time. The generated code snippet updates as you change values.

Rendering the live preview…

Usage

Examples

Ready-to-paste code snippets for your templates.

Image, icon and text

vue

Sizes

vue

Avatar Group

vue

Ecosystem

Family

Components from the same folder that share conventions and often compose together.