LedgerUI.Components.Avatar (LedgerUI v0.2.0)

Copy Markdown View Source

Avatars: an image or initials in a circle, a square, a squircle or any mask shape, with a status dot, a gradient ring, and stacked in groups.

<.avatar name="Ana Souza" color="auto" size="md" status="online" />
<.avatar initials="jd" color="info" variant="soft" />
<.avatar src="/images/jane.jpg" alt="Jane" gradient="sky-blue" size="lg" />
<.avatar kind="assistant" size="md" />

<.avatar_group more={3} size="sm">
  <.avatar :for={user <- @users} name={user.name} color="auto" size="sm" ring />
</.avatar_group>

size takes the names (3xs 16px, 2xs 20px, xs 24px, xs-plus 26px, sm 30px, md 36px, lg 44px, xl 56px, 2xl 72px, sm-plus 32px) or any number of pixels ("40"). The legacy palette of the canvas is available with color t1..t5 (pastel tones), and color="none" leaves only the base lu-av face.

Summary

Functions

avatar(assigns)

Attributes

  • src (:string) - Defaults to nil.
  • alt (:string) - The picture's text; the name when not given. Defaults to nil.
  • initials (:string) - Shown (upper-cased) when there is no src. Defaults to nil.
  • name (:string) - Gives the initials (first and last word) and color="auto". Defaults to nil.
  • icon (:string) - An icon drawn on the sunken face. Defaults to nil.
  • kind (:string) - Defaults to nil.Must be one of nil, "company", "customer", "supplier", "assistant", or "invite".
  • size (:string) - A size name or a number of pixels. Defaults to "sm".
  • shape (:string) - Defaults to "circle". Must be one of "circle", "square", "rounded", "squircle", "reuleaux-triangle", "diamond", "hexagon", "hexagon-2", "octagon", "star", "star-2", or "heart".
  • tint (:string) - CSS color for the initials' background (white text). Defaults to nil.
  • background (:string) - Any CSS background for the face (white text). Defaults to nil.
  • color (:string) - Defaults to "neutral". Must be one of "auto", "neutral", "primary", "secondary", "info", "success", "warning", "error", "t1", "t2", "t3", "t4", "t5", or "none".
  • variant (:string) - Defaults to "solid". Must be one of "solid", "soft", "bordered", or "skeleton".
  • status (:any) - Presence (online, away, busy, offline) or a tone; nil/false shows no dot. Defaults to nil.
  • status_position (:string) - Defaults to nil.Must be one of nil, "bottom-left", "bottom-right", "top-left", or "top-right".
  • ping (:boolean) - Animates the status dot. Defaults to false.
  • ring (:any) - true, 1, 2 or 4. Defaults to false.
  • ring_color (:string) - Defaults to nil.Must be one of nil, "white", "panel", "neutral", "primary", "secondary", "info", "success", "warning", or "error".
  • face_class (:any) - Defaults to nil.
  • gradient (:string) - Defaults to nil.Must be one of nil, "sky-blue", "amber-orange", "pink-rose", "purple-orange", "green-fuchsia", "purple-indigo", or "fuchsia-pink".
  • style (:string) - Defaults to nil.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block - Replaces the initials (an icon, a counter).

avatar_group(assigns)

Attributes

  • pulse (:boolean) - Defaults to false.
  • overlap (:string) - Defaults to "2". Must be one of "2", "3", "7", or "auto".
  • more (:integer) - Draws a "+N" avatar at the end. Defaults to nil.
  • hidden (:list) - The people that did not fit (maps with :name, optional :src). Needs id. Defaults to nil.
  • id (:string) - Defaults to nil.
  • size (:string) - Defaults to "xs".
  • spread (:boolean) - Defaults to false.
  • ring_color (:string) - Defaults to "white". Must be one of "white", or "panel".
  • label (:string) - Defaults to nil.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)