PtahUi.Components.Avatar (PtahUI v0.1.0)

Copy Markdown View Source

Avatar component. Shows an image or generated initials with a deterministic background color.

Summary

Functions

avatar(assigns)

Attributes

  • src (:string) - Image URL. When nil, shows initials. Defaults to nil.
  • name (:string) (required) - Full name — used for initials and color generation.
  • size (:atom) - Defaults to :md.
  • type (:atom) - Defaults to :user.
  • link (:string) - Wrap avatar in a navigate link. Defaults to nil.
  • class (:string) - Defaults to nil.
  • initials_text_class (:string) - Classes for the initials text. Defaults to "text-white font-medium".
  • palette (:list) - List of hex color strings for the fallback background. Chosen deterministically from the name. Defaults to ["#ED498D", "#24B0E7", "#DFB13E", "#96D628", "#7575D7", "#811824"].