LedgerUI.Components.Mask (LedgerUI v0.2.0)

Copy Markdown View Source

Crops its content to one of nine mask shapes: squircle, reuleaux-triangle, diamond, hexagon, hexagon-2, octagon, star, star-2 and heart.

<.mask shape="heart" src="/images/avatar.jpg" alt="Jane" size="64" />
<.mask shape="hexagon" size="56"><span>JD</span></.mask>
<.mask shape="star" label="Favorite" size="32" />

With src it renders the masked image; otherwise a block holding the inner content. The block keeps its inner content readable by screen readers; give it a label when the shape itself carries the meaning (role="img" and aria-label). The size is size (pixels, or an LedgerUI.Components.Avatar size name); paint it with style="background: ...".

It is drawn with the lu-av face of the avatar (LedgerUI.Components.Avatar).

Summary

Functions

mask(assigns)

Attributes

  • shape (:string) - Defaults to "squircle". Must be one of "squircle", "reuleaux-triangle", "diamond", "hexagon", "hexagon-2", "octagon", "star", "star-2", or "heart".
  • src (:string) - Defaults to nil.
  • alt (:string) - Defaults to "".
  • label (:string) - Names a block mask for assistive technology. Defaults to nil.
  • size (:string) - Pixels or an avatar size name. Defaults to "64".
  • style (:string) - Defaults to nil.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block