Components Avatars

Avatars

Avatars enable you to represent a users identity on screen.
Image avatars
https://res.cloudinary.com/wickedsites/image/upload/v1604268092/unnamed_sagz0l.jpg https://res.cloudinary.com/wickedsites/image/upload/v1604268092/unnamed_sagz0l.jpg https://res.cloudinary.com/wickedsites/image/upload/v1604268092/unnamed_sagz0l.jpg https://res.cloudinary.com/wickedsites/image/upload/v1604268092/unnamed_sagz0l.jpg https://res.cloudinary.com/wickedsites/image/upload/v1604268092/unnamed_sagz0l.jpg
heex
          <.avatar size="xs" src="img_1.png" />
<.avatar size="sm" src="img_1.png" />
<.avatar size="md" src="img_1.png" />
<.avatar size="lg" src="img_1.png" />
<.avatar size="xl" src="img_1.png" />

        
Avatars with placeholder icon
heex
          <.avatar size="xs"/>
<.avatar size="sm"/>
<.avatar size="md"/>
<.avatar size="lg"/>
<.avatar size="xl"/>

        
Avatars with placeholder initials
heex
          <.avatar name="Petal Components" size="xs" />
<.avatar name="Petal Components" size="sm"/>
<.avatar name="PC" />
<.avatar name="PC" size="lg"/>
<.avatar name="PC" size="xl"/>

        
Colored avatars with placeholder initials
heex
          <.avatar name="Matt Platts" size="xs" random_color />
<.avatar name="Nic Hoban" size="sm" random_color />
<.avatar name="James Cameron" random_color />
<.avatar name="Will Smith" size="lg" random_color />
<.avatar name="Peter Jackson" size="xl" random_color />

        
Avatar groups stacked
https://res.cloudinary.com/wickedsites/image/upload/v1604268092/unnamed_sagz0l.jpg https://res.cloudinary.com/wickedsites/image/upload/v1636595188/dummy_data/avatar_1_lc8plf.png https://res.cloudinary.com/wickedsites/image/upload/v1636595188/dummy_data/avatar_2_jhs6ww.png https://res.cloudinary.com/wickedsites/image/upload/v1636595189/dummy_data/avatar_14_rkiyfa.png
https://res.cloudinary.com/wickedsites/image/upload/v1604268092/unnamed_sagz0l.jpg https://res.cloudinary.com/wickedsites/image/upload/v1636595188/dummy_data/avatar_1_lc8plf.png https://res.cloudinary.com/wickedsites/image/upload/v1636595188/dummy_data/avatar_2_jhs6ww.png https://res.cloudinary.com/wickedsites/image/upload/v1636595189/dummy_data/avatar_14_rkiyfa.png
https://res.cloudinary.com/wickedsites/image/upload/v1604268092/unnamed_sagz0l.jpg https://res.cloudinary.com/wickedsites/image/upload/v1636595188/dummy_data/avatar_1_lc8plf.png https://res.cloudinary.com/wickedsites/image/upload/v1636595188/dummy_data/avatar_2_jhs6ww.png https://res.cloudinary.com/wickedsites/image/upload/v1636595189/dummy_data/avatar_14_rkiyfa.png
https://res.cloudinary.com/wickedsites/image/upload/v1604268092/unnamed_sagz0l.jpg https://res.cloudinary.com/wickedsites/image/upload/v1636595188/dummy_data/avatar_1_lc8plf.png https://res.cloudinary.com/wickedsites/image/upload/v1636595188/dummy_data/avatar_2_jhs6ww.png https://res.cloudinary.com/wickedsites/image/upload/v1636595189/dummy_data/avatar_14_rkiyfa.png
https://res.cloudinary.com/wickedsites/image/upload/v1604268092/unnamed_sagz0l.jpg https://res.cloudinary.com/wickedsites/image/upload/v1636595188/dummy_data/avatar_1_lc8plf.png https://res.cloudinary.com/wickedsites/image/upload/v1636595188/dummy_data/avatar_2_jhs6ww.png https://res.cloudinary.com/wickedsites/image/upload/v1636595189/dummy_data/avatar_14_rkiyfa.png
heex
          <.avatar_group avatars={[
  "img_1.png",
  "img_2.png",
  "img_3.png",
  "img_4.png",
]} size="xs"/>
<.avatar_group avatars={[
  "img_1.png",
  "img_2.png",
  "img_3.png",
  "img_4.png",
]} size="sm" />
<.avatar_group avatars={[
  "img_1.png",
  "img_2.png",
  "img_3.png",
  "img_4.png",
]} size="md" />
<.avatar_group avatars={[
  "img_1.png",
  "img_2.png",
  "img_3.png",
  "img_4.png",
]} size="lg" />
<.avatar_group avatars={[
  "img_1.png",
  "img_2.png",
  "img_3.png",
  "img_4.png",
]} size="xl" />

        
Properties
elixir
          # Avatar
attr(:src, :string, default: nil, doc: "hosted avatar URL")
attr(:size, :string, default: "md", values: ["xs", "sm", "md", "lg", "xl"])
attr(:class, :string, default: "", doc: "CSS class")
attr(:name, :string, default: nil, doc: "name for placeholder initials")

attr(:random_color, :boolean,
  default: false,
  doc: "generates a random color for placeholder initials avatar"
)

attr(:rest, :global)

# Avatar group
attr(:size, :string, default: "md", values: ["xs", "sm", "md", "lg", "xl"])
attr(:class, :string, default: "", doc: "CSS class")
attr(:avatars, :list, default: [], doc: "list of your hosted avatar URLs")
attr(:rest, :global)