Avatar

Data Display
stable

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

Aperçu

Rendu de l’aperçu en cours…

image

Rendu de l’aperçu en cours…

icon

Rendu de l’aperçu en cours…

text

Rendu de l’aperçu en cours…

large

Rendu de l’aperçu en cours…

rounded

Structure

Anatomie

Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.

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

Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et 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

Emplacements de contenu exposés par ce composant.

#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

Événements émis par ce composant.

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

API

Membres exposés

Propriétés et méthodes accessibles via ref template (defineExpose). Utilisés pour le contrôle programmatique.

<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.

Personnalisation

Variables CSS

Propriétés CSS personnalisées exposées par ce composant. Surchargez-les pour personnaliser sans perdre la compatibilité avec le thème.

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

Accessibilité

Rôles ARIA, navigation clavier et gestion du focus. Sourcé depuis le template réel du composant.

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.

Fondation

Design tokens

Extrait des tokens de ce composant — les variables --origam-<composant>---<propriété>, déclarées dans sa feuille de tokens tenue à la main, sans étape de build.

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.

Interactif

Playground

Modifiez les props en direct et observez le composant se mettre à jour. Le snippet de code généré suit vos changements.

Rendu de l’aperçu en cours…

Usage

Exemples

Extraits de code prêts à coller dans vos templates.

Image, icon and text

vue

Sizes

vue

Avatar Group

vue

Écosystème

Famille

Composants du même dossier qui partagent les conventions et se composent souvent ensemble.