ZoonkWeb.Components.Avatar (Zoonk v0.1.0-dev)

View Source

UI component for rendering avatars.

Summary

Functions

Renders an avatar.

Functions

avatar(assigns)

Renders an avatar.

It can use an image or a placeholder if no image is provided.

Examples

# Using an image
<.avatar src="https://example.com/avatar.png" alt="Leo da Vinci" />

# Using a placeholder, no src provided or nil
<.avatar alt="Leo Da Vinci" />

Attributes

  • src (:string) - URL of the avatar image. Defaults to nil.
  • alt (:string) (required) - Alt text for the avatar image - also used as a placeholder if no image is provided.
  • size (:atom) - Defaults to :sm. Must be one of :xs, :sm, :md, or :lg.
  • class (:any) - Defaults to nil.