ShadcnUI.Components.Foundation.Avatar (shadcn_ui v1.0.0)

Copy Markdown View Source

Initials-first identity presentation with an optional caller-owned image.

Applications own image URLs, privacy, caching, loading, failure policy, uploads, and identity records. Avatar performs no lookup or image lifecycle handling.

Summary

Functions

Renders stable initials with an optional image overlay.

Functions

avatar(assigns)

Renders stable initials with an optional image overlay.

image_src and a nonblank image_alt must be provided together. When an image is present its alternative text supplies the accessible name and the visible initials are hidden from assistive technology to avoid duplication.

Attributes

  • initials (:string) (required)
  • image_src (:string) - Defaults to nil.
  • image_alt (:string) - Defaults to nil.
  • size (:atom) - Defaults to :default. Must be one of :small, :default, or :large.
  • stack_position (:atom) - Defaults to :none. Must be one of :none, :first, :middle, or :last.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.